WIP: the mouse editor hands wasm its captured seed (improvise-ixxx)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
@@ -287,6 +287,39 @@ test.describe("a pointer event reaches the client and its answer is painted", ()
|
||||
await expect(page.locator("#grid tbody td.selected")).toHaveCount(1);
|
||||
});
|
||||
|
||||
// improvise-ixxx. The editor hands wasm the seed it captured at open, and
|
||||
// only wasm decides an untouched commit writes nothing — JS must pass it.
|
||||
test("an untouched mouse editor sends no write, and a touched one does", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.addInitScript(() => {
|
||||
window.__posted = [];
|
||||
const post = Worker.prototype.postMessage;
|
||||
Worker.prototype.postMessage = function (message, ...rest) {
|
||||
window.__posted.push(String(message));
|
||||
return post.call(this, message, ...rest);
|
||||
};
|
||||
});
|
||||
await openApp(page);
|
||||
const cells = page.locator("#grid tbody td");
|
||||
const writes = () =>
|
||||
page.evaluate(() => window.__posted.filter((m) => m.includes("SetCell")).length);
|
||||
|
||||
await cells.nth(4).click();
|
||||
await expect(cells.nth(4).locator("input")).toHaveCount(1);
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(page.locator("#grid input")).toHaveCount(0);
|
||||
await page.waitForTimeout(300);
|
||||
expect(await writes()).toBe(0);
|
||||
|
||||
// The control: without it a page that never sends anything passes above.
|
||||
await cells.nth(4).click();
|
||||
await expect(cells.nth(4).locator("input")).toHaveCount(1);
|
||||
await page.keyboard.type("1");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect.poll(writes).toBe(1);
|
||||
});
|
||||
|
||||
// improvise-b8ot moved these five surfaces onto one handler per stable root.
|
||||
// The three tests below are the properties a naive delegation loses, each of
|
||||
// which is silent: the page still paints, and only the pointer stops working.
|
||||
|
||||
Reference in New Issue
Block a user