Last active
December 11, 2017 11:17
-
-
Save unfalse/c20b3dc396bde5a1473f242ec337b7d8 to your computer and use it in GitHub Desktop.
Changing select value not working on enzyme react test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('enter valid data for connection; enable proxy; check if button is disabled', () => { | |
const component = getComponent(mount); // mount from enzyme | |
enterCredentials(component); | |
const proxySelect = component.find('select'); | |
// currently tried these variants: | |
proxySelect.simulate('change', { target: { value: true } } ); | |
// component.find('select').simulate('select', true); | |
// component.find('select').simulate('select', 'Yes'); | |
// component.find('select').simulate('change', { target: { value: true } } ); | |
// /* Mutating: */ | |
// proxySelect.node.selectedIndex = 1; | |
// | |
// Producing this error: | |
// | |
// Attempted to access ReactWrapper::node, which was previously a private property on | |
// Enzyme ReactWrapper instances, but is no longer and should not be relied upon. | |
// Consider using the getElement() method instead. | |
// | |
// at ReactWrapper.get (node_modules/enzyme/build/ReactWrapper.js:1689:15) | |
expect(proxySelect.prop('value')).toBe(true); | |
expect(component.find('button').prop('disabled')).toBe(false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment