enzymejs/chai-enzyme

Can't figure out how to check for non-breaking space rendering

MrNice opened this issue · 2 comments

This fails:

const button = mount(<Button>Open Project&nbsp;</Button>)
expect(button).text('Open Project ')

because

AssertionError: expected <StatusButton /> to have text 'Open Project ', but it has 'Open Project '

My work around : Ignore the nbsp; even though its important

expect(button).to.include.text('Open Project')
Ruto8 commented

Any tips? Stumbled upon this one myself.

A space and a nbsp aren't the same; instead of 'Open Project ', try 'Open Project ' (i used option-space there to generate it on my Mac)