Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('sets the aria-hidden prop based on the active prop', () => {
const props = { active: false, children: 'woop' };
let message = renderIntoDocument();
let messageNode = findDOMNode(message);
expect(messageNode.getAttribute('aria-hidden')).toBe('true');
props.active = true;
message = renderIntoDocument();
messageNode = findDOMNode(message);
expect(messageNode.getAttribute('aria-hidden')).toBe('false');
});
it('should render validation errors for required fields', () => {
const form = ReactTestUtils.renderIntoDocument(
);
const formDOM = findDOMNode(form);
submitForm(form);
expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(6);
});
it('should conditionally require phone number', () => {
it('sets center and zoom props', () => {
const center = [1.2, 3.4]
const zoom = 10
const map = renderIntoDocument(<map>)
const mapLeaflet = map.leafletElement
expect(mapLeaflet.getCenter().lat).toBe(center[0])
expect(mapLeaflet.getCenter().lng).toBe(center[1])
expect(mapLeaflet.getZoom()).toBe(zoom)
})
</map>
it('Should call onPreview callback', done => {
const doneOp = () => {
done();
};
const instance = ReactTestUtils.renderIntoDocument(
);
ReactTestUtils.Simulate.click(
findDOMNode(instance).querySelector('.rs-uploader-file-item-title')
);
});
it('Renders correctly when `Checkbox` is not a direct child of `CheckboxGroup` and `checkboxDepth` is passed', function() {
const component = renderIntoDocument(
<label> Kiwi</label>
<label> Watermelon</label>
);
expect(component).to.be.ok;
});
it('Should be active by value', () => {
const value = ['abcd'];
const instance = ReactTestUtils.renderIntoDocument(
);
const instanceDom = findDOMNode(instance.menuContainer);
assert.equal(instanceDom.querySelector(activeClassName).innerText, value);
});
test( 'GifitButton emits "toggle" event when clicked', function( t ){
t.plan(1);
var gifit_button = TestUtils.renderIntoDocument( );
var gifit_button_div_element = TestUtils.findRenderedDOMComponentWithClass( gifit_button, 'gifit-button' );
gifit_events.once( 'toggle', function(){
t.pass('emits "toggle" event');
});
TestUtils.Simulate.click( gifit_button_div_element );
});
lab.test('it renders showing save success alert', (done) => {
const props = Object.assign({}, defaultProps, {
showSaveSuccess: true
});
const FormEl = React.createElement(Form, props);
const form = ReactTestUtils.renderIntoDocument(FormEl);
const alerts = ReactTestUtils.scryRenderedDOMComponentsWithClass(form, 'alert-success');
Code.expect(alerts).to.have.length(1);
done();
});
function mount(Component) {
testSwitch = TestUtils.renderIntoDocument(Component);
switchNode = ReactDOM.findDOMNode(testSwitch);
}
function renderToNode(component) {
return ReactDOM.findDOMNode(TestUtils.renderIntoDocument(component));
}