chai-enzyme icon indicating copy to clipboard operation
chai-enzyme copied to clipboard

Assertion tagName tries to shallowrender the given component

Open marcodejongh opened this issue 9 years ago • 4 comments

When using the following assertion:

expect(wrapper.children().at(1)).to.have.tagName('td');

I get a error because on of the props of the child of the wrapper at 1 is undefined.

If I remove the tagName assertion and just leave this one:

 expect(wrapper.children().at(1)).to.have.prop('className', 'action');

The error is gone. So there is a discrepancy between how to.have.prop and to.have.tagName do their assertions.

marcodejongh avatar Jan 21 '16 00:01 marcodejongh

@marcodejongh that's sadly correct.

for various reasons, we had to implement it this way initially and we decided to release with it (it's not a 1.0 release, so didn't bother me too much).

we should fix this as soon as we can. if you would like to submit a pr it will be very welcome!

vesln avatar Jan 21 '16 08:01 vesln

Could you make sure that you assign issues that you're picking up? I have 20% time tomorrow so I intend to fix all issues raised by me. I went ahead with making these issues to get some discussion going about them

marcodejongh avatar Jan 21 '16 08:01 marcodejongh

@marcodejongh i just added you as a collaborator to the project. me and the rest of the team are super thankful to all people who are willing to contribute to our projects, so this is our way to say "thank you".

feel free to assign yourself to whatever you would like to tackle. i'd personally love another person start digging inside the project, as i'm sure that you'll be able to find more issues and potential improvements that we could introduce.

vesln avatar Jan 21 '16 09:01 vesln

Sorry guys, any update on this one?

albertogasparin avatar Jul 26 '16 09:07 albertogasparin