Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to execute CableReady operations on StimulusReflex::Element #489

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
standardize
  • Loading branch information
marcoroth committed Feb 21, 2023
commit 1bf7a8c82f9a0bbec688e20b8972c46eb2750105
8 changes: 4 additions & 4 deletions test/reflex_element_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build_payload(operations = [])

test "broadcasts updates using element.broadcast" do
expected = build_payload(
{"selector"=>"#element-selector", "xpath"=>false, "html"=>"<p>Some HTML</p>", "reflexId"=>"666", "operation"=>"innerHtml"}
{"selector" => "#element-selector", "xpath" => false, "html" => "<p>Some HTML</p>", "reflexId" => "666", "operation" => "innerHtml"}
)

assert_broadcast_on(@reflex.stream_name, expected) do
Expand All @@ -40,7 +40,7 @@ def build_payload(operations = [])

test "selector can be overwritten" do
expected = build_payload(
{"selector"=>"#overwritten", "xpath"=>false, "html"=>"<p>Some HTML</p>", "reflexId"=>"666", "operation"=>"innerHtml"}
{"selector" => "#overwritten", "xpath" => false, "html" => "<p>Some HTML</p>", "reflexId" => "666", "operation" => "innerHtml"}
)

assert_broadcast_on(@reflex.stream_name, expected) do
Expand All @@ -50,8 +50,8 @@ def build_payload(operations = [])

test "broadcasts using element.broadcast chained" do
expected = build_payload [
{"selector"=>"#element-selector", "xpath"=>false, "html"=>"<p>Some HTML</p>", "reflexId"=>"666", "operation"=>"innerHtml"},
{"name"=>"abc", "detail"=>{"some"=>"key"}, "reflexId"=>"666", "selector"=>"#element-selector", "operation"=>"dispatchEvent"}
{"selector" => "#element-selector", "xpath" => false, "html" => "<p>Some HTML</p>", "reflexId" => "666", "operation" => "innerHtml"},
{"name" => "abc", "detail" => {"some" => "key"}, "reflexId" => "666", "selector" => "#element-selector", "operation" => "dispatchEvent"}
]

assert_broadcast_on(@reflex.stream_name, expected) do
Expand Down