Skip to content

Commit 8b11af5

Browse files
committed
fix: md editor integ test F-key shortcut triggering pro upsell
F8 is bound to the Live Preview edit toggle (_handlePreviewBtnClick), which calls LiveDevelopment.setMode(LIVE_EDIT_MODE) and shows the UPSELL_TYPE_LIVE_EDIT dialog for free users. The F-key forwarding tests dispatched F8 into the mdviewer iframe, which was then forwarded to Phoenix's document-level F8 handler — stacking 2 upsell dialogs in the test runner. Swap to F9 (unbound) — the test only needs to verify that F-keys are forwarded from the iframe, it doesn't need F8 specifically. Also rename the outer describe to "livepreview:Markdown Editor 1" to match sibling suites ("Edit Mode", "Edit More", "Table Editing").
1 parent 6278f10 commit 8b11af5

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

test/spec/md-editor-integ-test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ define(function (require, exports, module) {
222222
}, "md preview synced with editor content", 5000);
223223
}
224224

225-
describe("livepreview:Markdown Editor", function () {
225+
describe("livepreview:Markdown Editor 1", function () {
226226

227227
if (Phoenix.browser.desktop.isFirefox ||
228228
(Phoenix.isTestWindowPlaywright && !Phoenix.browser.desktop.isChromeBased)) {
@@ -527,18 +527,20 @@ define(function (require, exports, module) {
527527
await _enterEditMode();
528528
await _focusMdContent();
529529

530-
const listener = _listenForShortcut("F8");
531-
_dispatchPlainKeyInMdIframe("F8", { keyCode: 119, code: "F8" });
532-
await awaitsFor(() => listener.check(), "F8 shortcut to be forwarded in edit mode");
530+
// Use F9 (unbound) — F8 is bound to the Live Preview edit toggle which shows
531+
// a pro upsell dialog for free users and blocks tests.
532+
const listener = _listenForShortcut("F9");
533+
_dispatchPlainKeyInMdIframe("F9", { keyCode: 120, code: "F9" });
534+
await awaitsFor(() => listener.check(), "F9 shortcut to be forwarded in edit mode");
533535
listener.cleanup();
534536
}, 10000);
535537

536538
it("should F-key shortcuts work in reader mode", async function () {
537539
await _enterReaderMode();
538540

539-
const listener = _listenForShortcut("F8");
540-
_dispatchPlainKeyInMdIframe("F8", { keyCode: 119, code: "F8" });
541-
await awaitsFor(() => listener.check(), "F8 shortcut to be forwarded in reader mode");
541+
const listener = _listenForShortcut("F9");
542+
_dispatchPlainKeyInMdIframe("F9", { keyCode: 120, code: "F9" });
543+
await awaitsFor(() => listener.check(), "F9 shortcut to be forwarded in reader mode");
542544
listener.cleanup();
543545
}, 10000);
544546

0 commit comments

Comments
 (0)