UX: resets active message when scrolling (#21305)

This will avoid the messages actions floating around while scrolling. Note it's not testing the thread counterpart yet as I have a plan in mind to tests channels and threads in a clean way in the near future.
This commit is contained in:
Joffrey JAFFEUX
2023-05-02 14:21:30 +02:00
committed by GitHub
parent 6c90747dea
commit 69a72015f0
6 changed files with 55 additions and 6 deletions

View File

@ -250,4 +250,28 @@ RSpec.describe "Chat channel", type: :system, js: true do
expect(page).to have_selector("code.lang-ruby")
end
end
context "when scrolling" do
before do
channel_1.add(current_user)
50.times { Fabricate(:chat_message, chat_channel: channel_1) }
sign_in(current_user)
end
it "resets the active message" do
chat.visit_channel(channel_1)
last_message = find(".chat-message-container:last-child")
last_message.hover
expect(page).to have_css(
".chat-message-actions-container[data-id='#{last_message["data-id"]}']",
)
find(".chat-messages-scroll").scroll_to(0, -1000)
expect(page).to have_no_css(
".chat-message-actions-container[data-id='#{last_message["data-id"]}']",
)
end
end
end