Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const el = T.renderIntoDocument(
<textarea required="{required}" placeholder="{placeholder}" name="{name}" id="{id}" disabled="{disabled}"> )
// Get the `<textarea>`.
const textarea = T.findRenderedDOMComponentWithTag(el, 'textarea')
// ===================
// Test for existence.
// ===================
it('exists in the page', function () {
expect(T.isCompositeComponent(el)).toBe(true)
})
// ==================
// Test for textarea.
// ==================
it('is disabled', function () {
expect(textarea.disabled).toBe(true)
})</textarea>
test('is properly shaped and handles events', (t) => {
const tree = TestUtils.renderIntoDocument()
let counter = TestUtils.findRenderedComponentWithType(tree, Counter)
TestUtils.Simulate.click(TestUtils.findRenderedDOMComponentWithTag(counter, 'button'))
t.is(counter.props.count, 1, 'should receive and increment counter')
t.is(TestUtils.findRenderedDOMComponentWithTag(counter, 'h1').textContent, 'Count: 1', 'DOM populated accordingly')
const spy = sinon.spy()
counter = TestUtils.renderIntoDocument()
const button = TestUtils.findRenderedDOMComponentWithTag(counter, 'button')
TestUtils.Simulate.click(button)
t.truthy(spy.calledOnce, 'onIncrement should get called when a click on button happens')
})
it('icon is rendered', () => {
const buttonCpt = TestUtils.findRenderedDOMComponentWithTag(renderedTest, 'button');
const icon = buttonCpt.getElementsByTagName('i')[0];
expect(icon.textContent).toBe('apps');
})
it('should render a title', function () {
var component = testUtils.findRenderedDOMComponentWithTag(htmlComponent, 'title');
expect(component.textContent).to.be.empty;
});
it('Should render with an <h2> that includes Sample Counter text.', function () {
const h2 = TestUtils.findRenderedDOMComponentWithTag(_rendered, 'h2');
expect(h2).to.exist;
expect(h2.textContent).to.match(/Sample Counter/);
});
</h2>
it('should get called when a click on button happens', () => {
const spy = sinon.spy()
const counter = TestUtils.renderIntoDocument(
)
const button = TestUtils.findRenderedDOMComponentWithTag(
counter, 'button'
)
TestUtils.Simulate.click(button)
expect(spy).to.have.been.calledOnce
})
})
it('shape is rendered', () => {
const buttonCpt = TestUtils.findRenderedDOMComponentWithTag(renderedTest, 'button');
expect(buttonCpt.getAttribute('class').indexOf('mdl-button--raised')).not.toBe(-1);
});
it('icon is rendered', () => {
it('prop: onClick className style', done => {
let h = createMemoryHistory()
let tree = render(
(e.preventDefault(), done())}>go where?
, node)
let a = findRenderedDOMComponentWithTag(tree, 'a')
expect(a.pathname).toEqual('/x')
expect([ ...a.classList ]).toEqual([ 'some', 'thing', 'here' ])
Simulate.click(a)
})
return watchlist._req.then(() => {
expect(watchlist.state.screen).toEqual(SCREEN);
var table = TestUtils.findRenderedDOMComponentWithTag(
watchlist, 'table');
expect(table).toBeDefined();
});
});
it('should render workspace', () => {
let workspace = renderWorkspace({
component: {
component: TestComponent,
componentName: 'Test Component'
}
});
let textarea = TestUtils.findRenderedDOMComponentWithTag(
workspace, 'textarea'
);
TestUtils.Simulate.change(textarea);
});