Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Should output a prev button', () => {
const instance = getInstance();
ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'rs-icon-page-previous');
});
it('Should render a button by toggleComponentClass={Button}', () => {
const instance = ReactTestUtils.renderIntoDocument(
);
ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'rs-btn');
});
});
it('should have extra classes', () => {
const newProps = { ...fakeProps, extraClasses: fakeExtraClasses.join(' ') };
const component = TestUtils.renderIntoDocument();
const row = TestUtils.findRenderedDOMComponentWithClass(component, 'react-grid-Row');
fakeExtraClasses.forEach((c) => {
const containsExtraClass = row.className.indexOf(c) > -1;
expect(containsExtraClass).toBe(true);
});
});
});
it('has correct item styles', () => {
component = TestUtils.renderIntoDocument(<menu><div>An item</div></menu>);
firstItem = TestUtils.findRenderedDOMComponentWithClass(component, 'bm-item-list').children[0];
expect(firstItem.style.display).to.equal('block');
});
it('accepts an optional burgerButtonClassName', () => {
component = TestUtils.renderIntoDocument(<menu>);
const button = TestUtils.findRenderedDOMComponentWithClass(component, 'bm-burger-button');
expect(button.classList.toString()).to.contain('custom-class');
});
</menu>
it('has correct item styles', () => {
const firstItem = TestUtils.findRenderedDOMComponentWithClass(component, 'bm-item-list').children[0];
expect(firstItem.style.display).to.equal('block');
});
assert.throws(() => TestUtils.findRenderedDOMComponentWithClass(field, 'focused'));
function renderTestApp () {
const testApp = renderIntoDocument();
const dropdown = findRenderedComponentWithType(testApp, Dropdown);
const dropdownElement = findRenderedDOMComponentWithClass(dropdown, 'dropdown');
const dropdownElementDomNode = findDOMNode(dropdownElement);
const trigger = findRenderedComponentWithType(testApp, DropdownTrigger);
const triggerElement = findRenderedDOMComponentWithClass(trigger, 'dropdown__trigger');
const content = findRenderedComponentWithType(testApp, DropdownContent);
const contentElement = findRenderedDOMComponentWithClass(content, 'dropdown__content');
const contentElementDomNode = findDOMNode(contentElement);
return {
testApp,
dropdown,
dropdownElement,
dropdownElementDomNode,
trigger,
triggerElement,
content,
contentElement,
contentElementDomNode
};
}
return (
)
}
}
const TestForm = reduxForm({ form: 'testForm' })(Form)
const dom = TestUtils.renderIntoDocument(
)
const addButton = TestUtils.findRenderedDOMComponentWithClass(dom, 'add')
const removeButton = TestUtils.findRenderedDOMComponentWithClass(
dom,
'remove'
)
TestUtils.Simulate.click(addButton)
expect(store.getState()).toEqualMap({
form: {
testForm: {
values: {
foo: {
bar: ['dog', 'cat', 'fish']
}
},
registeredFields: {
'foo.bar': { name: 'foo.bar', type: 'FieldArray', count: 1 },
'foo.bar[0]': { name: 'foo.bar[0]', type: 'Field', count: 1 },
it('renders create input as an item when creating', () => {
const items = ['1', '2', '3'];
const list = makeList(items, { initialState: { creatingItem: true } });
const createItem = findRenderedDOMComponentWithClass(list, 'create-item-input');
expect(createItem).toBeDefined();
});