Files
once-campfire/test/controllers/messages/boosts_controller_test.rb
T
Sam Ruby c057484dfb Wire the inline boost link to the soft keyboard
link_to passed `action: "soft-keyboard#open"` as a plain option, so it
rendered as an `action` attribute, which Stimulus never reads. The link
in messages/_actions.html.erb already passes it under `data:`; this one
now does too, so tapping "Add a boost" on a touch device opens the
keyboard for the boost form as the menu's link does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 20:06:53 -04:00

34 lines
1.0 KiB
Ruby

require "test_helper"
class Messages::BoostsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
@message = messages(:first)
end
test "index wires the new boost link to the soft keyboard" do
get message_boosts_url(@message)
assert_response :success
assert_select ".message__boost-inline a.boost__action[data-action='soft-keyboard#open']"
end
test "create" do
assert_turbo_stream_broadcasts [ @message.room, :messages ], count: 1 do
assert_difference -> { @message.boosts.count }, 1 do
post message_boosts_url(@message, format: :turbo_stream), params: { boost: { content: "Morning!" } }
assert_redirected_to message_boosts_url(@message)
end
end
end
test "destroy" do
assert_turbo_stream_broadcasts [ @message.room, :messages ], count: 1 do
assert_difference -> { @message.boosts.count }, -1 do
delete message_boost_url(@message, boosts(:first), format: :turbo_stream)
assert_response :success
end
end
end
end