-
-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
Given this component and the following tests:
const Test = ({ className, shouldDisplay }) => shouldDisplay ? <div className={className}></div> : null;
const thing = mount(<Test className="foo" shouldDisplay={true} />);
expect(thing).to.have.descendants('.foo');
const thing2 = mount(<Test className="foo" shouldDisplay={false} />);
expect(thing2).to.not.have.descendants('.foo');
The not descendants test on thing2 fails with the message: AssertionError: expected <Test /> not to have descendants '.foo' HTML: Not available due to: Cannot read property 'outerHTML' of null
Switching the last expectation to the following:
expect(thing2.find('.foo')).to.not.exist;
it still fails with the same error: AssertionError: expected the node in <Test /> not to exist HTML: Not available due to: Cannot read property 'outerHTML' of null
This is with enzyme 3.2.0 and react 15.4.2. With enzyme 2.x and the pre-1.0 releases, these tests worked just fine.
chrisdevereux and frosas
Metadata
Metadata
Assignees
Labels
No labels