From bbb086850bd0529fdf93138a7bb5ec48d21793b5 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Wed, 24 Apr 2024 15:13:35 +0200 Subject: [PATCH] Add test for Alpine.js-like attributes --- test/html/document_fragment_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/html/document_fragment_test.rb b/test/html/document_fragment_test.rb index 848eff64..f4bccc26 100644 --- a/test/html/document_fragment_test.rb +++ b/test/html/document_fragment_test.rb @@ -549,6 +549,15 @@ class StimulusReflex::HTML::DocumentFragmentTest < ActiveSupport::TestCase assert_equal %(), fragment.inner_html.squish end + test "non-standard HTML attributes (Alpine.js-like)" do + html = %() + + fragment = StimulusReflex::HTML::DocumentFragment.new(html) + + assert_equal %(), fragment.to_html.squish + assert_equal %(), fragment.outer_html.squish + end + test "should extract a fragment of the HTML" do raw_html = <<-HTML