diff --git a/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx b/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
index 38ebca1e4..f4f70b243 100644
--- a/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
+++ b/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
@@ -1105,21 +1105,56 @@ describeWithDOM('mount', () => {
});
});
- it('should not pass in null or false nodes', () => {
+ it('does not pass in null or false nodes', () => {
const wrapper = mount((
-
+
+ foo bar
{null}
{false}
-
+
));
const stub = sinon.stub();
- stub.returns(true);
- const spy = sinon.spy(stub);
- wrapper.findWhere(spy);
- expect(spy.callCount).to.equal(2);
+ wrapper.findWhere(stub);
+
+ const passedNodes = stub.getCalls().map(({ args: [firstArg] }) => firstArg);
+ const hasDOMNodes = passedNodes.map(n => [n.debug(), n.getDOMNode() && true]);
+ const expected = [
+ [wrapper.debug(), true], // root
+ ['', true], // first div
+ ['\n foo bar\n
', true], // second div
+ ['foo bar', null], // second div's contents
+ ];
+ expect(hasDOMNodes).to.eql(expected);
+
+ // the root, plus the 2 renderable children, plus the grandchild text
+ expect(stub).to.have.property('callCount', 4);
});
+ it('allows `.text()` to be called on text nodes', () => {
+ const wrapper = mount((
+
+
+ foo bar
+ {null}
+ {false}
+
+ ));
+
+ const stub = sinon.stub();
+ wrapper.findWhere(stub);
+
+ const passedNodes = stub.getCalls().map(({ args: [firstArg] }) => firstArg);
+
+ const textContents = passedNodes.map(n => [n.debug(), n.text()]);
+ const expected = [
+ [wrapper.debug(), 'foo bar'], // root
+ ['', ''], // first div
+ ['\n foo bar\n
', 'foo bar'], // second div
+ ['foo bar', null], // second div's contents
+ ];
+ expect(textContents).to.eql(expected);
+ });
});
describe('.setProps(newProps[, callback])', () => {