diff options
Diffstat (limited to 'actionview/test/template/tag_helper_test.rb')
-rw-r--r-- | actionview/test/template/tag_helper_test.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index d07312ace3..278c3e855f 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -171,7 +171,7 @@ class TagHelperTest < ActionView::TestCase content_tag("p") { content_tag("b", "Hello") }, output_buffer assert_equal tag.p(tag.b("Hello")), - tag.p {tag.b("Hello") }, + tag.p { tag.b("Hello") }, output_buffer end @@ -203,10 +203,10 @@ class TagHelperTest < ActionView::TestCase end def test_content_tag_with_unescaped_array_class - str = content_tag("p", "limelight", {class: ["song", "play>"]}, false) + str = content_tag("p", "limelight", { class: ["song", "play>"] }, false) assert_equal "<p class=\"song play>\">limelight</p>", str - str = content_tag("p", "limelight", {class: ["song", ["play>"]]}, false) + str = content_tag("p", "limelight", { class: ["song", ["play>"]] }, false) assert_equal "<p class=\"song play>\">limelight</p>", str end @@ -228,7 +228,7 @@ class TagHelperTest < ActionView::TestCase end def test_content_tag_with_unescaped_empty_array_class - str = content_tag("p", "limelight", {class: []}, false) + str = content_tag("p", "limelight", { class: [] }, false) assert_equal '<p class="">limelight</p>', str end @@ -305,39 +305,39 @@ class TagHelperTest < ActionView::TestCase def test_tag_builder_disable_escaping assert_equal '<a href="&"></a>', tag.a(href: "&", escape_attributes: false) - assert_equal '<a href="&">cnt</a>', tag.a(href: "&" , escape_attributes: false) { "cnt"} + assert_equal '<a href="&">cnt</a>', tag.a(href: "&" , escape_attributes: false) { "cnt" } assert_equal '<br data-hidden="&">', tag.br("data-hidden": "&" , escape_attributes: false) assert_equal '<a href="&">content</a>', tag.a("content", href: "&", escape_attributes: false) - assert_equal '<a href="&">content</a>', tag.a(href: "&", escape_attributes: false) { "content"} + assert_equal '<a href="&">content</a>', tag.a(href: "&", escape_attributes: false) { "content" } end def test_data_attributes ["data", :data].each { |data| assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{"key":"value"}" data-string-with-quotes="double"quote"party"" data-string="hello" data-symbol="foo" />', - tag("a", data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag("a", data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{"key":"value"}" data-string-with-quotes="double"quote"party"" data-string="hello" data-symbol="foo" />', - tag.a(data: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag.a(data: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) } end def test_aria_attributes ["aria", :aria].each { |aria| assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{"key":"value"}" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />', - tag("a", aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag("a", aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{"key":"value"}" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />', - tag.a(aria: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag.a(aria: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) } end def test_link_to_data_nil_equal div_type1 = content_tag(:div, "test", "data-tooltip" => nil) - div_type2 = content_tag(:div, "test", data: {tooltip: nil}) + div_type2 = content_tag(:div, "test", data: { tooltip: nil }) assert_dom_equal div_type1, div_type2 end def test_tag_builder_link_to_data_nil_equal div_type1 = tag.div "test", 'data-tooltip': nil - div_type2 = tag.div "test", data: {tooltip: nil} + div_type2 = tag.div "test", data: { tooltip: nil } assert_dom_equal div_type1, div_type2 end |