From b31ea0c240773c557a6c4e1a0e470a9d442406ee Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 1 Nov 2012 08:49:47 -0200 Subject: Add test to ensure data attributes are properly escaped with tag helpers Closes #8091 --- actionpack/test/template/tag_helper_test.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb index f0a7ce0bc9..9e711c6529 100644 --- a/actionpack/test/template/tag_helper_test.rb +++ b/actionpack/test/template/tag_helper_test.rb @@ -87,6 +87,11 @@ class TagHelperTest < ActionView::TestCase assert_equal "

\">limelight

", str end + def test_content_tag_with_data_attributes + assert_dom_equal '

limelight

', + content_tag('p', "limelight", data: { number: 1, string: 'hello', string_with_quotes: 'double"quote"party"' }) + end + def test_cdata_section assert_equal "]]>", cdata_section("") end @@ -118,8 +123,8 @@ class TagHelperTest < ActionView::TestCase def test_data_attributes ['data', :data].each { |data| - assert_dom_equal '', - 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'} } }) + assert_dom_equal '', + 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 end -- cgit v1.2.3