diff --git a/lib/rails/dom/testing/assertions/dom_assertions.rb b/lib/rails/dom/testing/assertions/dom_assertions.rb index 9ed78d3..9c5721d 100644 --- a/lib/rails/dom/testing/assertions/dom_assertions.rb +++ b/lib/rails/dom/testing/assertions/dom_assertions.rb @@ -61,7 +61,7 @@ def equal_child?(child, other_child, strict) if strict child.to_s == other_child.to_s else - child.to_s.strip == other_child.to_s.strip + child.to_s.split == other_child.to_s.split end end diff --git a/test/dom_assertions_test.rb b/test/dom_assertions_test.rb index 3bb83c6..f663e43 100644 --- a/test/dom_assertions_test.rb +++ b/test/dom_assertions_test.rb @@ -100,6 +100,23 @@ def test_dom_equal_with_indentation HTML end + def test_dom_equal_with_surrounding_whitespace + canonical = %{

Lorem ipsum dolor

sit amet, consectetur adipiscing elit

} + assert_dom_equal(canonical, <<-HTML) +

+ Lorem + ipsum + dolor +

+ +

+ sit amet, + consectetur + adipiscing elit +

+ HTML + end + def test_dom_not_equal_with_interior_whitespace with_space = %{hello world} without_space = %{helloworld}