diff --git a/lib/date_select_separator/action_view_extension.rb b/lib/date_select_separator/action_view_extension.rb index b5b2060..c8a85c0 100644 --- a/lib/date_select_separator/action_view_extension.rb +++ b/lib/date_select_separator/action_view_extension.rb @@ -41,7 +41,7 @@ def wrapper_select_tag(select_tag, type, separator_options) wrapper_options = separator_options[:wrapper_select_tag] wrapper_options = wrapper_options.is_a?(Hash) ? default_options.merge(wrapper_options) : default_options class_name = wrapper_options[:class_prefix] + "#{type}" - content_tag(wrapper_options[:html_tag], select_tag, class: class_name) + "\n" + content_tag(wrapper_options[:html_tag], "\n".html_safe + select_tag, class: class_name) + "\n" end def separator_text(type, separator_options) diff --git a/test/date_select_separator_test.rb b/test/date_select_separator_test.rb index 550e1f6..7763b34 100644 --- a/test/date_select_separator_test.rb +++ b/test/date_select_separator_test.rb @@ -102,7 +102,7 @@ def test_select_day_with_custom_separator_and_translation end def test_select_day_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_day(Time.mktime(2003, 8, 16)) expected << %(dd\n).html_safe expected << %(
\n) @@ -112,7 +112,7 @@ def test_select_day_with_custom_separator_and_wrapper_select_tag end def test_select_day_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_day(Time.mktime(2003, 8, 16)) expected << %(dd\n).html_safe expected << %(\n) @@ -285,7 +285,7 @@ def test_select_month_with_custom_separator_and_translation end def test_select_month_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_month(Time.mktime(2003, 8, 16)) expected << %(mm\n).html_safe expected << %(
\n) @@ -295,7 +295,7 @@ def test_select_month_with_custom_separator_and_wrapper_select_tag end def test_select_month_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_month(Time.mktime(2003, 8, 16)) expected << %(mm\n).html_safe expected << %(\n) @@ -408,7 +408,7 @@ def test_select_year_with_custom_separator_and_translation end def test_select_year_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_year(Time.mktime(2003, 8, 16)) expected << %(yy\n).html_safe expected << %(
\n) @@ -418,7 +418,7 @@ def test_select_year_with_custom_separator_and_wrapper_select_tag end def test_select_year_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_year(Time.mktime(2003, 8, 16)) expected << %(yy\n).html_safe expected << %(\n) @@ -519,7 +519,7 @@ def test_select_hour_with_custom_separator_and_translation end def test_select_hour_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_hour(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(h\n).html_safe expected << %(
\n) @@ -528,7 +528,7 @@ def test_select_hour_with_custom_separator_and_wrapper_select_tag end def test_select_hour_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_hour(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(h\n).html_safe expected << %(\n) @@ -643,7 +643,7 @@ def test_select_minute_with_custom_separator_and_translation end def test_select_minute_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_minute(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(min\n).html_safe expected << %(
\n) @@ -652,7 +652,7 @@ def test_select_minute_with_custom_separator_and_wrapper_select_tag end def test_select_minute_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_minute(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(min\n).html_safe expected << %(\n) @@ -745,7 +745,7 @@ def test_select_second_with_custom_separator_and_translation end def test_select_second_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << select_second(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(sec\n).html_safe expected << %(
\n) @@ -754,7 +754,7 @@ def test_select_second_with_custom_separator_and_wrapper_select_tag end def test_select_second_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << select_second(Time.mktime(2003, 8, 16, 8, 4, 18)) expected << %(sec\n).html_safe expected << %(\n) @@ -1187,21 +1187,21 @@ def test_select_date_with_custom_separator_and_translation end def test_select_date_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << %(\n" expected << %(yy\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %(\n" expected << %(mm\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -1212,21 +1212,21 @@ def test_select_date_with_custom_separator_and_wrapper_select_tag end def test_select_date_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << %(\n" expected << %(yy\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %(\n" expected << %(mm\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %(\n" @@ -1683,21 +1683,21 @@ def test_select_datetime_with_custom_separator_and_translation end def test_select_datetime_with_custom_separator_and_wrapper_select_tag - expected = %(
) + expected = %(
\n) expected << %(\n" expected << %(yy\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %(\n" expected << %(mm\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -1706,7 +1706,7 @@ def test_select_datetime_with_custom_separator_and_wrapper_select_tag expected << " — " - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -1715,7 +1715,7 @@ def test_select_datetime_with_custom_separator_and_wrapper_select_tag expected << " : " - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -1726,21 +1726,21 @@ def test_select_datetime_with_custom_separator_and_wrapper_select_tag end def test_select_datetime_with_custom_separator_and_wrapper_select_tag_with_options - expected = %() + expected = %(\n) expected << %(\n" expected << %(yy\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %(\n" expected << %(mm\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %(\n" @@ -1749,7 +1749,7 @@ def test_select_datetime_with_custom_separator_and_wrapper_select_tag_with_optio expected << " — " - expected << %() + expected << %(\n) expected << %(\n" @@ -1758,7 +1758,7 @@ def test_select_datetime_with_custom_separator_and_wrapper_select_tag_with_optio expected << " : " - expected << %() + expected << %(\n) expected << %(\n" @@ -2061,7 +2061,7 @@ def test_select_time_with_custom_separator_and_wrapper_select_tag expected << %(\n) expected << %(\n) - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -2070,7 +2070,7 @@ def test_select_time_with_custom_separator_and_wrapper_select_tag expected << " : " - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -2086,7 +2086,7 @@ def test_select_time_with_custom_separator_and_wrapper_select_tag_with_options expected << %(\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %(\n" @@ -2095,7 +2095,7 @@ def test_select_time_with_custom_separator_and_wrapper_select_tag_with_options expected << " : " - expected << %() + expected << %(\n) expected << %(\n" @@ -2791,21 +2791,21 @@ def test_date_select_with_custom_separator_and_wrapper_select_tag @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %(
) + expected = %(
\n) expected << %{\n" expected << %(yy\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %{\n" expected << %(mm\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %{\n" @@ -2819,21 +2819,21 @@ def test_date_select_with_custom_separator_and_wrapper_select_tag_with_options @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %() + expected = %(\n) expected << %{\n" expected << %(yy\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %{\n" expected << %(mm\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %{\n" @@ -3182,14 +3182,14 @@ def test_time_select_with_custom_separator_and_wrapper_select_tag expected << %{\n} expected << %{\n} - expected << %(
) + expected << %(
\n) expected << %(\n" expected << %(h\n) expected << %(
\n) expected << " : " - expected << %(
) + expected << %(
\n) expected << %(\n" @@ -3691,21 +3691,21 @@ def test_datetime_select_with_custom_separator_and_wrapper_select_tag @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %(
) + expected = %(
\n) expected << %{\n" expected << %(yy\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %{\n" expected << %(mm\n) expected << %(
\n) - expected << %(
) + expected << %(
\n) expected << %{\n" @@ -3714,14 +3714,14 @@ def test_datetime_select_with_custom_separator_and_wrapper_select_tag expected << " — " - expected << %(
) + expected << %(
\n) expected << %{\n" expected << %(h\n) expected << %(
\n) expected << " : " - expected << %(
) + expected << %(
\n) expected << %{\n" @@ -3735,21 +3735,21 @@ def test_datetime_select_with_custom_separator_and_wrapper_select_tag_with_optio @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %() + expected = %(\n) expected << %{\n" expected << %(yy\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %{\n" expected << %(mm\n) expected << %(\n) - expected << %() + expected << %(\n) expected << %{\n" @@ -3758,14 +3758,14 @@ def test_datetime_select_with_custom_separator_and_wrapper_select_tag_with_optio expected << " — " - expected << %() + expected << %(\n) expected << %{\n" expected << %(h\n) expected << %(\n) expected << " : " - expected << %() + expected << %(\n) expected << %{\n"