Sha256: f70043fc8408c01f5eef7a8e848302982e405401830cffe14f5ab2f6b9e51eb0

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

# require_relative "broadcaster_test_case"

# class StimulusReflex::SelectorBroadcasterTest < StimulusReflex::BroadcasterTestCase
# test "morphs the contents of an element if the selector(s) are present in both original and morphed html fragments" do
# broadcaster = StimulusReflex::SelectorBroadcaster.new(@reflex)
# broadcaster.append_morph("#foo", "<div id=\"foo\"><span>bar</span></div>")

# expected = {
# "cableReady" => true,
# "operations" => {
# "morph" => [
# {
# "selector" => "#foo",
# "html" => "<span>bar</span>",
# "childrenOnly" => true,
# "permanentAttributeName" => nil,
# "stimulusReflex" => {
# "some" => :data,
# "morph" => :selector
# }
# }
# ]
# }
# }

# assert_broadcast_on @reflex.stream_name, expected do
# broadcaster.broadcast nil, some: :data
# end
# end

# test "replaces the contents of an element and ignores permanent-attributes if the selector(s) aren't present in the replacing html fragment" do
# broadcaster = StimulusReflex::SelectorBroadcaster.new(@reflex)
# broadcaster.append_morph("#foo", "<div id=\"baz\"><span>bar</span></div>")

# expected = {
# "cableReady" => true,
# "operations" => {
# "innerHtml" => [
# {
# "selector" => "#foo",
# "html" => "<div id=\"baz\"><span>bar</span></div>",
# "stimulusReflex" => {
# "some" => :data,
# "morph" => :selector
# }
# }
# ]
# }
# }

# assert_broadcast_on @reflex.stream_name, expected do
# broadcaster.broadcast nil, some: :data
# end
# end
# end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stimulus_reflex-3.4.2 test/broadcasters/selector_broadcaster_test.rb
stimulus_reflex-3.4.1 test/broadcasters/selector_broadcaster_test.rb
stimulus_reflex-3.4.0 test/broadcasters/selector_broadcaster_test.rb
stimulus_reflex-3.4.0.pre9 test/broadcasters/selector_broadcaster_test.rb