Skip to content

Commit

Permalink
Merge pull request #19111 from calixteman/fix_highlight_test_with_kb
Browse files Browse the repository at this point in the history
Fix the highlight integration test when highlighting with the keyboard
  • Loading branch information
calixteman authored Nov 27, 2024
2 parents 079eb24 + 5d77a64 commit 052b001
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/integration/highlight_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,12 @@ describe("Highlight Editor", () => {
await page.keyboard.press("ArrowRight");
}
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown");
// Here and elsewhere, we add a small delay between press and release
// to make sure that a keyup event for Shift is triggered after
// selectionchange (it's why adding the delay on the last before
// releasing shift is enough).
// It works with a value of 10ms, but we use 100ms to be sure.
await page.keyboard.press("ArrowDown", { delay: 100 });
await page.keyboard.up("Shift");

await page.waitForSelector(sel);
Expand Down Expand Up @@ -1066,7 +1071,7 @@ describe("Highlight Editor", () => {
15
);
await page.keyboard.down("Shift");
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
await page.keyboard.up("Shift");

await page.waitForSelector(getEditorSelector(0));
Expand Down Expand Up @@ -1715,7 +1720,7 @@ describe("Highlight Editor", () => {
);
await page.keyboard.down("Shift");
for (let i = 0; i < 3; i++) {
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
}
await page.keyboard.up("Shift");

Expand All @@ -1730,7 +1735,7 @@ describe("Highlight Editor", () => {
);
await page.keyboard.down("Shift");
for (let i = 0; i < 3; i++) {
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
}
await page.keyboard.up("Shift");
await page.waitForSelector(getEditorSelector(1));
Expand Down

0 comments on commit 052b001

Please sign in to comment.