diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-02-14 13:04:29 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2016-02-14 13:04:29 +0100 |
commit | cf433905d5bd10d871ba2355490fc3dfe515cf3e (patch) | |
tree | 97c06fa7f488acf60959b6e6321526f25db5af55 | |
parent | 73fb2977cab8cd9b8ed7bb61df3072e2ca74b3ce (diff) | |
parent | aeee438bf120f44a4402250fa50ef530f3c830a8 (diff) | |
download | rails-cf433905d5bd10d871ba2355490fc3dfe515cf3e.tar.gz rails-cf433905d5bd10d871ba2355490fc3dfe515cf3e.tar.bz2 rails-cf433905d5bd10d871ba2355490fc3dfe515cf3e.zip |
Merge pull request #23648 from xw19/link_to-data-nil-test
Link to data nil test
-rw-r--r-- | actionview/lib/action_view/helpers/tag_helper.rb | 1 | ||||
-rw-r--r-- | actionview/test/template/tag_helper_test.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 2562504896..42e7358a1d 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -154,6 +154,7 @@ module ActionView options.each_pair do |key, value| if TAG_PREFIXES.include?(key) && value.is_a?(Hash) value.each_pair do |k, v| + next if v.nil? output << sep output << prefix_tag_option(key, k, v, escape) end diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 6f7a78ccef..f3956a31f6 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -173,4 +173,10 @@ class TagHelperTest < ActionView::TestCase 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} }) + assert_dom_equal div_type1, div_type2 + end end |