Update the browser, editor, settings, and installer

This commit is contained in:
Knotty Wyvern
2026-10-12 14:46:21 -07:00
parent 909894b9c8
commit f6eaa52949
163 changed files with 146260 additions and 534 deletions
+34 -4
View File
@@ -36,15 +36,26 @@ try {
const before = await editor.innerText();
await page.keyboard.press("End");
await page.keyboard.type(" TEST");
assert.notEqual(await editor.innerText(), before);
const typed = await editor.innerText();
assert.notEqual(typed, before);
await page.mouse.click(rect.x + 42, rect.y + rect.height / 2, { button: "right" });
const menu = page.getByRole("menu", { name: "Spelling actions", exact: true });
await menu.waitFor();
await mkdir(".audit", { recursive: true });
await page.screenshot({ path: ".audit/spelling-native.png" });
await menu.getByRole("menuitem", { name: "Undo Ctrl+Z", exact: true }).click();
await page.waitForFunction(expected => document.querySelector(".cm-content")?.innerText === expected, before);
console.log("PASS: real WebView2 command dispatch through the shared menu restores the editor text.");
const undo = menu.getByRole("menuitem", { name: "Undo Ctrl+Z", exact: true });
assert.equal(await undo.isEnabled(), true, "The native Undo command is enabled after typing");
await undo.click();
await page.waitForFunction(previous => document.querySelector(".cm-content")?.innerText !== previous, typed);
const remaining = (await editor.innerText()).match(/^I recieved a letter\.(.*)$/m)?.[1];
assert.ok(remaining !== undefined && remaining.length < " TEST".length && " TEST".startsWith(remaining), "Native Undo reduces the appended text and preserves the original paragraph");
// WebView2 and CodeMirror can group typing differently. Restore the fixture through editor history.
for (let attempt = 0; attempt < 8 && await editor.innerText() !== before; attempt++) {
await page.keyboard.press("Control+z");
await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))));
}
assert.equal(await editor.innerText(), before, "Bounded keyboard Undo restores the exact original editor text");
console.log("PASS: real WebView2 Undo reduces the typed text, and bounded editor Undo restores the fixture.");
await page.mouse.click(rect.x + 42, rect.y + rect.height / 2, { button: "right" });
await menu.waitFor();
@@ -60,6 +71,25 @@ try {
assert.notEqual(process.env.REQUIRE_NATIVE_SUGGESTIONS, "1", "The test WebView2 profile supplied no spelling suggestions");
console.log("SKIP: native spelling correction. This WebView2 profile supplied no suggestions. Desktop acceptance is still required.");
}
for (const kind of ["input", "textarea", "dialog"]) {
await page.evaluate(kind => {
const field = document.createElement(kind === "input" ? "input" : "textarea");
field.id = "native-spelling-field"; field.spellcheck = true;
field.value = "I recieved a letter.";
field.style.cssText = "position:fixed;left:250px;top:200px;width:500px;height:100px;font:16px/24px Arial;padding:10px;z-index:100";
if (kind === "dialog") { const dialog = document.createElement("dialog"); dialog.id = "native-spelling-dialog"; dialog.append(field); document.body.append(dialog); dialog.showModal(); }
else document.body.append(field);
field.focus();
}, kind);
const field = page.locator("#native-spelling-field"), box = await field.boundingBox();
await page.mouse.click(box.x + 48, box.y + (kind === "input" ? box.height / 2 : 22), { button: "right" });
await menu.getByRole("menuitem", { name: "received", exact: true }).click();
assert.equal(await field.inputValue(), "I received a letter.", kind + " corrects the clicked word");
await page.keyboard.press("Control+z");
assert.equal(await field.inputValue(), "I recieved a letter.", kind + " retains undo");
await page.evaluate(() => { document.getElementById("native-spelling-field")?.remove(); document.getElementById("native-spelling-dialog")?.remove(); });
}
console.log("PASS: native spelling corrections and undo in inputs, card textareas, and top-layer dialogs.");
} finally {
await page.keyboard.press("Escape").catch(() => {});
await browser.close();