A platform for community discussion. Free, open, simple.
DEV: Keep the ctrl/cmd click test from navigating away (#45500)
Jarek Radosz351810c8a76d
diff --git a/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs b/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjsindex 1a12a95981f..32783ddc74b 100644--- a/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs+++ b/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs@@ -708,12 +708,11 @@ module("Integration | Component | AiSearchDiscoveries", function (hooks) {const link = document.querySelector(".ai-search-discoveries__discovery a");assert.strictEqual(link?.tagName, "A", "link exists in discovery text");- const clickEvent = new MouseEvent("click", {- bubbles: true,- cancelable: true,- ctrlKey: true,+ // The browser would otherwise follow the link and unload the test runner+ document.addEventListener("click", (event) => event.preventDefault(), {+ once: true,});- link.dispatchEvent(clickEvent);+ await click(link, { ctrlKey: true });assert.false(this.closeSearchMenuCalled,