Ensure backwards compatibility with Trix

This commit is contained in:
Stanko K.R.
2026-07-20 17:56:05 +02:00
parent a3d2939569
commit bfb57a23f9
8 changed files with 86 additions and 9 deletions
+18
View File
@@ -68,6 +68,24 @@ class ComposerTest < ApplicationSystemTestCase
assert_equal [ users(:jason) ], message.reload.mentionees
end
test "editing a legacy trix message keeps its mention and embed" do
body = %(<div>Hey #{mention_attachment_for(:jason)} check <action-text-attachment content-type="application/vnd.actiontext.opengraph-embed" url="https://example.com/image.png" href="https://example.com/" filename="Example title" caption="Example description"></action-text-attachment></div>)
message = Message.create! room: rooms(:designers), body: body, client_message_id: "legacy", creator: users(:jz)
join_room rooms(:designers)
within_message message do
reveal_message_actions
find(".message__edit-btn").click
assert_edit_editor_text "Jason"
click_on "Save changes"
end
assert_selector last_message_selector(".mention"), text: "Jason"
assert_selector last_message_selector(%(.og-embed__title a[href="https://example.com/"])), text: "Example title"
assert_equal [ users(:jason) ], message.reload.mentionees
end
test "replying quotes the original message with attribution" do
within_message messages(:third) do
reveal_message_actions