Skip to content

Commit

Permalink
Add test for Alpine.js-like attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Apr 24, 2024
1 parent a1a5027 commit bbb0868
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/html/document_fragment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ class StimulusReflex::HTML::DocumentFragmentTest < ActiveSupport::TestCase
assert_equal %(<feSpecularLighting><fePointLight></fePointLight></feSpecularLighting>), fragment.inner_html.squish
end

test "non-standard HTML attributes (Alpine.js-like)" do
html = %(<button @click.prevent="something">Button</button>)

fragment = StimulusReflex::HTML::DocumentFragment.new(html)

assert_equal %(<button @click.prevent="something">Button</button>), fragment.to_html.squish
assert_equal %(<button @click.prevent="something">Button</button>), fragment.outer_html.squish
end

test "should extract a fragment of the HTML" do
raw_html = <<-HTML
<div id="container">
Expand Down

0 comments on commit bbb0868

Please sign in to comment.