module Turbo::TestAssertions

def assert_no_turbo_stream(action:, target: nil, targets: nil)


assert_no_turbo_stream action: "remove", target: "message_1"

The following assertion would fail:



Given the following HTML fragment:

attribute
* :targets [String] matches the element's [targets]
the value will be transformed by calling dom_id
[target] attribute. If the value responds to #to_key,
* :target [String, #to_key] matches the element's
attribute
* :action [String] matches the element's [action]

==== Options

element.
Assert that the rendered fragment of HTML does not contain a ``
def assert_no_turbo_stream(action:, target: nil, targets: nil)
  selector =  %(turbo-stream[action="#{action}"])
  selector << %([target="#{target.respond_to?(:to_key) ? dom_id(target) : target}"]) if target
  selector << %([targets="#{targets}"]) if targets
  assert_select selector, count: 0
end

def assert_turbo_stream(action:, target: nil, targets: nil, count: 1, &block)


end
assert_select "template p", text: "Hello!"
assert_turbo_stream action: "replace", target: "message_1" do

The following assertion would pass: