-
Notifications
You must be signed in to change notification settings - Fork 57
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
should ignore whitespace just like assert_dom_equal
#121
Comments
@jyeharry Thanks for opening this issue. I tend to agree that this is how the Is this something you'd be interested in working on and contributing? I'd be happy to help you land a pull request. But if you don't think you're able to do that, that's fine, I'm sure I can find time to work on this at some point. |
@flavorjones I'd love to contribute! I don't actually have much rails experience though, I've just been teaching myself lately. My experience (four years) is primarily in node. However I've wanted to contribute to open source for ages so I'd love to help here. Though since I'm not so familiar with this library and contributing to open source in general it would be great if you could point me in the right direction and I'll get started. |
@jyeharry I'm glad you're game to help! I'm not totally sure how I want to approach the solution yet, so I don't have much advice to give yet (and I'd be happy to take the responsibility of making it work), but a great start would be opening a pull request that has a failing test in it that describes your scenario above! Would you be up for adding that test in a pull request? |
@flavorjones yeah sure! I'll give it a go over the coming week and hopefully have something for you. |
In one of my views I have this:
My formatter automatically breaks this onto new lines like so:
Because of this, running a test that contains this assertion fails:
This is due to the text I'm passing to
assert_select
having no newlines in it, but in the view code there are newlines even though the browser actually drops those newlines.So the test output is as follow:
My current fix is to either turn off my formatter for that file, or to update the assertion to use regex and replace the spaces with
\s+
like this:However, the test should really treat excess whitespace the same as the browser does by dropping it.
Sounds like the same thing was done for
assert_dom_equal
in #84.The text was updated successfully, but these errors were encountered: