Use the waitForUnselectedEditor integration test helper function more

This commit applies the `waitForUnselectedEditor` helper function to the
remaining places, that most likely predate the introduction of the
helper function, to deduplicate the code and to have a unified way of
checking if a given editor is unselected.
This commit is contained in:
Tim van der Meij 2025-01-04 19:15:26 +01:00
parent 4d4e1befeb
commit 5126210fff
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -38,6 +38,7 @@ import {
waitForSelectedEditor, waitForSelectedEditor,
waitForSerialized, waitForSerialized,
waitForTimeout, waitForTimeout,
waitForUnselectedEditor,
} from "./test_utils.mjs"; } from "./test_utils.mjs";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import fs from "fs"; import fs from "fs";
@ -1044,9 +1045,7 @@ describe("Highlight Editor", () => {
await page.mouse.click(x, y, { count: 2, delay: 100 }); await page.mouse.click(x, y, { count: 2, delay: 100 });
await page.waitForSelector(`${getEditorSelector(0)}`); await page.waitForSelector(`${getEditorSelector(0)}`);
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.waitForSelector( await waitForUnselectedEditor(page, getEditorSelector(0));
`${getEditorSelector(0)}:not(.selectedEditor)`
);
await setCaretAt( await setCaretAt(
page, page,
@ -1797,7 +1796,7 @@ describe("Highlight Editor", () => {
await page.waitForSelector(editorSelector); await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1); await waitForSerialized(page, 1);
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`); await waitForUnselectedEditor(page, editorSelector);
const clickHandle = await waitForPointerUp(page); const clickHandle = await waitForPointerUp(page);
y = rect.y - rect.height; y = rect.y - rect.height;
@ -1868,7 +1867,7 @@ describe("Highlight Editor", () => {
await page.waitForSelector(editorSelector); await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1); await waitForSerialized(page, 1);
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`); await waitForUnselectedEditor(page, editorSelector);
const clickHandle = await waitForPointerUp(page); const clickHandle = await waitForPointerUp(page);
y = rect.y - 3 * rect.height; y = rect.y - 3 * rect.height;