DEV: a real selection change has a pointerup event (#1427)

This is needed for https://github.com/discourse/discourse/pull/33143 as we now rely on this pointerup event.
This commit is contained in:
Joffrey JAFFEUX 2025-06-12 00:59:21 +02:00 committed by GitHub
parent 442530a154
commit 26217e51f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,8 @@ RSpec.describe "AI Post helper", type: :system, js: true do
"var element = document.querySelector('#{topic_page.post_by_number_selector(selected_post.post_number)} .cooked p'); " +
"var range = document.createRange(); " + "range.selectNodeContents(element); " +
"var selection = window.getSelection(); " + "selection.removeAllRanges(); " +
"selection.addRange(range);",
"selection.addRange(range);" + "const event = new PointerEvent('pointerup');" +
"document.dispatchEvent(event);",
)
end