Skip to content

Conversation

@angelikatyborska
Copy link
Contributor

@angelikatyborska angelikatyborska commented Mar 16, 2018

As requested by @ljharb, this is a failing test case for issue #1566.

expect(spy.callCount).to.equal(3); - I am not certain if this assertion should expect 3 calls or 4 calls. That depends if the null node that is currently passed will be skipped or fixed not to be null.

(Now fixes #1566)

Test case for issue #1566 without a fix.
@mhuggins
Copy link

mhuggins commented Jun 3, 2018

+1 on merging this and getting a fix.

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

Hmm - I'm not sure I think there's a bug here. I think that it makes sense for findWhere to receive every node - specifically in case it wants to find text nodes - and that it makes sense for .getDOMNode() to return null on text nodes.

However, I think that .text() on a textNode should just return the text, so i'll update this PR with the updated tests, and then add a fix.

Thank you - this helped me understand the problem!

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - @angelikatyborska, do you agree?

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

I'm going to merge this.

@ljharb ljharb merged commit d114e68 into enzymejs:master Jun 29, 2018
@xixixao
Copy link

xixixao commented Jun 29, 2018

This changes the type of text() to be ?string, so we should update Flow types (and presumably TS?).

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

@xixixao we don't use or maintain our own types, so please file issues in the appropriate places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"findWhere" by node.text() when mounted causes "Cannot read property 'textContent' of null"

5 participants