mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-08-29 18:07:42 +09:00
Ensure backwards compatibility with Trix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user