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

Make assert_dom_equal ignore insignificant whitespace #71

Closed
wants to merge 5 commits into from

Conversation

joshpencheon
Copy link

Following on from issue #62 and PR #66, I've taken a stab at implementing this. Not suggesting this ready to go, but just trying to keep the discussion alive.

In the past, we've had crude downstream implementations, but I've tried to get something that works with the current Rails approach, and behaves something like an inline formatting context.

Happy to keep working on this, or hand over to @chancancode or another.

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@joshpencheon
Copy link
Author

I've changed the approach taken, to try and make behaviour comparable to @chancancode's suggestion on #62:

is it okay that it "mostly does what you would expect", but isn't exactly the same as what happens in the browser's rendering engine (and there will be a strict mode for the current behavior)

I haven't implemented the "strict mode", but have hooked in to the existing logic in such a way as to make it trivial if the API is agreed on, e.g:

assert_dom_equal(expected, actual, message=nil, strict: false)

The JRuby build is failing because of unrelated issues, possibly this: travis-ci/travis-ci/issues/8446

@jduff
Copy link
Contributor

jduff commented Jul 8, 2020

With #84 merged I think it covers the case this PR was for, please give master a try and see if there were any cases missed!

@joshpencheon
Copy link
Author

Thanks @jduff ! I see test coverage overlaps, and I've tested master against our projects and it's working fine. :)

Closing in favour of #84

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

Successfully merging this pull request may close these issues.

4 participants