mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 02:09:30 +00:00
What is the problem? There are two problems being fixed here: 1. When opening the composer, we are seeing multiple requests made to the `/composer_messages` endpoint. This is due to our use of the `transitionend` event on the `#reply-control` element. The event is fired once for each transition event and the `#reply-control` element has multiple transition events. 2. System tests have animations disabled so the `transitionend` event does not fire at all. What is the solution? Instead of relying on the `transitionend` event, we can instead just observer the `composerState` property of the `ComposerBody` component and trigger the `composer:opened` appEvent with a delay that is similar to the transition duration used for the `ComposerBody` component.
23 lines
784 B
Ruby
23 lines
784 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Composer don't feed the trolls popup", type: :system, js: true do
|
|
fab!(:user) { Fabricate(:user) }
|
|
fab!(:troll) { Fabricate(:user) }
|
|
fab!(:topic) { Fabricate(:topic, user: user) }
|
|
fab!(:post) { Fabricate(:post, user: user, topic: topic) }
|
|
fab!(:reply) { Fabricate(:post, user: troll, topic: topic) }
|
|
fab!(:flag) { Fabricate(:flag, post: reply, user: user) }
|
|
let(:topic_page) { PageObjects::Pages::Topic.new }
|
|
|
|
before { sign_in user }
|
|
|
|
it "shows a popup when about to reply to a troll" do
|
|
SiteSetting.educate_until_posts = 0
|
|
|
|
topic_page.visit_topic(topic)
|
|
topic_page.click_post_action_button(reply, :reply)
|
|
|
|
expect(topic_page).to have_composer_popup_content(I18n.t("education.dont_feed_the_trolls"))
|
|
end
|
|
end
|