diff --git a/actionview/test/fixtures/test/_content_tag_nested_in_content_tag_with_data_attributes_out_of_erb.erb b/actionview/test/fixtures/test/_content_tag_nested_in_content_tag_with_data_attributes_out_of_erb.erb new file mode 100644 index 0000000000000..716d03ee42ca2 --- /dev/null +++ b/actionview/test/fixtures/test/_content_tag_nested_in_content_tag_with_data_attributes_out_of_erb.erb @@ -0,0 +1,4 @@ +<%= content_tag 'div', data: { controller: "read-more", 'read-more-more-text-value': "Read more", 'read-more-less-text-value': "Read less" } do %> + <%= content_tag('p', 'Content text', class: 'content-class', data: { 'test-name': "content" }) %> + <%= content_tag('button', 'Read more', class: 'expand-button', data: { action: 'read-more#toggle'}) %> +<% end %> diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 5ec22f6cf7d94..1b18b6d546e2c 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -298,6 +298,11 @@ def test_content_tag_nested_in_content_tag_in_erb assert_equal "

\n Hello\n

", view.render("test/builder_tag_nested_in_content_tag") end + def test_content_tag_nested_in_content_tag_with_data_attributes_out_of_erb + assert_equal "
\n

Content text

\n \n
", + view.render("test/content_tag_nested_in_content_tag_with_data_attributes_out_of_erb") + end + def test_content_tag_with_escaped_array_class str = content_tag("p", "limelight", class: ["song", "play>"]) assert_equal "

limelight

", str