We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For example
const ReportLink = ({ href }) => ( <a href={href}>This is a link</a> ); const props = { href: '/link/to' } const reportLink = shallow(<ReportLink {...props}/>); expect(reportLink).to.have.attr('href').equal(props.href);
Gives the following error Window is not a constructor (evaluating '(0, _cheerio2.default)(this.wrapper.html())')
Window is not a constructor (evaluating '(0, _cheerio2.default)(this.wrapper.html())')
Works fine if I use mount instead of shallow. Documentation suggests that attr is support in a shallow render.
mount
shallow
attr
Using chai-enzyme v0.7.1
The text was updated successfully, but these errors were encountered:
What happens when you do:
expect(reportLink).to.have.attr('href', props.href);
Sorry, something went wrong.
also what about export(reportLink).to.have.prop('href', props.href)?
export(reportLink).to.have.prop('href', props.href)
expect(reportLink).to.have.attr('href', props.href); yields the same error.
expect(reportLink).to.have.prop('href', props.href); does work and will probably be sufficient most of the times.
expect(reportLink).to.have.prop('href', props.href);
I guess there is an open question on when attr can/should be used? Is it just for full mount rendering?
It’s using full Cheerio rendering; and yes, I’d say shallow rendering assertions are going to consistently be a better bet.
No branches or pull requests
For example
Gives the following error
Window is not a constructor (evaluating '(0, _cheerio2.default)(this.wrapper.html())')
Works fine if I use
mount
instead ofshallow
. Documentation suggests thatattr
is support in ashallow
render.Using chai-enzyme v0.7.1
The text was updated successfully, but these errors were encountered: