Skip to content
New issue

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

assert.dom('foo', 'bar') should throw an error #633

Closed
Turbo87 opened this issue Mar 4, 2020 · 0 comments · Fixed by #634
Closed

assert.dom('foo', 'bar') should throw an error #633

Turbo87 opened this issue Mar 4, 2020 · 0 comments · Fixed by #634

Comments

@Turbo87
Copy link
Collaborator

Turbo87 commented Mar 4, 2020

I managed to write an assertion like assert.dom('foo', 'bar') today, where I actually meant assert.dom('foo').hasText('bar') 😱

This is clearly a bug, and actually one that we would be able to catch. The .dom() function does accept an optional second argument, but if it is not undefined then it should be an Element (or at least have querySelector() and querySelectorAll() methods).

I would propose that in the .dom() we check that, if a rootElement is passed to the function, the rootElement has querySelector() and querySelectorAll() methods and otherwise we throw an error, which would have prevented the issue above.

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

Successfully merging a pull request may close this issue.

1 participant