Add interface languages and improve themes and workspace controls for 0.1.36

This commit is contained in:
Knotty Wyvern
2026-10-15 10:55:59 -07:00
parent b066359b66
commit 68e86ab6eb
98 changed files with 5499 additions and 874 deletions
+46 -1
View File
@@ -25,7 +25,10 @@ await page.addInitScript(() => {
if (command === "plugin:event|listen") { listeners.set(args.event, args.handler); return ++sequence; }
if (command === "plugin:event|unlisten") return;
if (command.startsWith("spelling_menu_")) { window.spellingTest.commands.push({ method: command, ...args }); return; }
if (command === "spelling_suggestions") return { language: "en-US", words: [], misspelled: false };
if (command === "spelling_suggestions") {
if (window.spellingTest.delay) return new Promise(resolve => window.spellingTest.resolve = resolve);
return { language: "en-US", words: [], misspelled: false };
}
if (command === "workspace_last_path") return root;
if (command === "workspace_open") return { root, name: "tab-menu-workspace", watch_mode: "native" };
if (command === "workspace_read") { if (!files.has(args.rel)) throw new Error("missing"); return files.get(args.rel); }
@@ -208,6 +211,37 @@ try {
await emitSpelling("new");
assert.deepEqual(await page.evaluate(() => window.spellingTest.commands.at(-1)), { method: "spelling_menu_select", request: "old", command: null });
await dismiss();
await page.evaluate(() => {
window.spellingTest.delay = true;
const input = document.querySelector('#native-spelling-test');
input.value = 'recieved'; input.focus(); input.setSelectionRange(3, 3);
input.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true }));
window.spellingTest.emit({ request: 'delayed-spelling', fallback_spelling: true, items: [
{ id: 90, name: 'copy', label: 'Copy', shortcut: '', kind: 0, enabled: true, checked: false, children: [] },
] });
});
await spelling.waitFor();
assert.equal(await item('Copy').count(), 1, 'Editing actions appear before the spelling service resolves');
await page.evaluate(() => { window.spellingTest.resolve({ language: 'en-US', words: ['received'], misspelled: true }); window.spellingTest.delay = false; });
await item('received').waitFor();
await page.screenshot({ path: `.audit/menu-spelling-async-${theme}.png` });
await dismiss();
await page.evaluate(() => {
window.spellingTest.delay = true;
document.querySelector('#native-spelling-test').dispatchEvent(new MouseEvent('contextmenu', { bubbles: true }));
window.spellingTest.emit({ request: 'dismissed-spelling', fallback_spelling: true, items: [
{ id: 91, name: 'copy', label: 'Copy', shortcut: '', kind: 0, enabled: true, checked: false, children: [] },
] });
});
await spelling.waitFor();
await dismiss();
await page.evaluate(async () => {
window.spellingTest.resolve({ language: 'en-US', words: ['received'], misspelled: true });
window.spellingTest.delay = false;
await new Promise(resolve => requestAnimationFrame(resolve));
});
assert.equal(await spelling.count(), 0, 'Late spelling results cannot reopen a dismissed menu');
await page.evaluate(() => { document.querySelector('#native-spelling-test').value = 'Original'; });
await page.locator("#native-spelling-test").evaluate(node => node.remove());
await page.evaluate(() => {
const input = document.createElement("input");
@@ -220,6 +254,17 @@ try {
assert.deepEqual(await page.evaluate(() => window.spellingTest.commands.at(-1)), { method: "spelling_menu_select", request: "ordinary-input", command: null, fallback: true });
}
await page.setViewportSize({ width: 420, height: 320 });
await page.evaluate(async () => {
const { actionMenu } = await import("/src/lib/ui/actionMenu.ts");
const root = actionMenu(418, 318, [{ label: "Modifier toutes les occurrences dans le document", icon: "select", shortcut: "Ctrl+F2" }], () => root.remove(), "Long translated label");
});
const translated = menu("Long translated label");
assert(await translated.locator('.action-label').evaluate(node => {
const css = getComputedStyle(node);
return css.whiteSpace === 'normal' && css.textOverflow !== 'ellipsis' && node.scrollWidth <= node.clientWidth;
}), 'Long translated actions wrap without truncation');
await page.screenshot({ path: '.audit/menu-translated-long-label.png' });
await dismiss();
await page.evaluate(async () => {
const { actionMenu } = await import("/src/lib/ui/actionMenu.ts");
const root = actionMenu(418, 318, [