Files
discourse/plugins/discourse-details/spec/system/details_spec.rb
Joffrey JAFFEUX 8873a33b7a FIX: uses text selection when using hide details (#33049)
When hiding details if the user has currently a text selection we want
to use it as the content of the details element.

/t/-/154716/30
2025-06-03 19:53:45 +02:00

28 lines
766 B
Ruby

# frozen_string_literal: true
describe "Details button", type: :system do
fab!(:admin)
let(:composer) { PageObjects::Components::Composer.new }
let(:rich) { composer.rich_editor }
context "with rich editor" do
before do
SiteSetting.rich_editor = true
sign_in(admin)
end
it "uses the text selection for content" do
visit("/new-topic")
composer.fill_content("test :+1:").toggle_rich_editor.select_all
find(".toolbar-popup-menu-options").click
find(".select-kit-row[data-name='Hide Details']").click
rich.click(x: 22, y: 30) # hack for pseudo element
expect(rich).to have_css(
"details img.emoji[src=\"/images/emoji/twitter/+1.png?v=#{Emoji::EMOJI_VERSION}\"]",
)
end
end
end