diff --git a/e2e/calculator.spec.js b/e2e/calculator.spec.js index cac3872..2177c35 100644 --- a/e2e/calculator.spec.js +++ b/e2e/calculator.spec.js @@ -16,6 +16,16 @@ function entry(tool, label) { return tool.locator(".calculator-entry").filter({ has: tool.page().getByRole("button", { name: `Supprimer ${label}`, exact: true }) }); } +async function storedScrollPreference(page) { + return page.evaluate(async () => { + const db = await import("/src/utils/indexedDbStorage.js"); + const snapshot = await db.getToolboxSnapshot(); + const toolbox = snapshot.toolboxes.find((item) => item.modules.some((module) => module.type === "calculator")); + const calculator = toolbox?.modules.find((module) => module.type === "calculator"); + return snapshot.moduleData[`${toolbox?.id}:${calculator?.id}`]?.scrollResults === true; + }); +} + async function saveRoot(tool, formula, label) { await tool.getByRole("textbox", { name: "Calcul", exact: true }).fill(formula); await tool.getByLabel("Libellé", { exact: true }).fill(label); @@ -123,10 +133,12 @@ test("reset clears only the draft, new calculation returns to root, and clipboar const scroll = tool.getByRole("button", { name: "Liste scrollable", exact: true }); await expect(scroll).toHaveAttribute("aria-pressed", "false"); await scroll.click(); + await expect.poll(() => storedScrollPreference(page)).toBe(true); await page.reload(); await expect(scroll).toHaveAttribute("aria-pressed", "true"); await expect(tool.locator(".calculator-tree")).toHaveCSS("overflow-y", "auto"); await scroll.click(); + await expect.poll(() => storedScrollPreference(page)).toBe(false); await page.reload(); await expect(scroll).toHaveAttribute("aria-pressed", "false"); await expect(tool.locator(".calculator-entry")).toHaveCount(3); diff --git a/e2e/table.spec.js b/e2e/table.spec.js index 0327df6..d8d6ce4 100644 --- a/e2e/table.spec.js +++ b/e2e/table.spec.js @@ -112,6 +112,7 @@ test("pointer selections move blocks and insert ranges into formulas without cha await expect(cell(table, "B3")).toHaveValue("6"); await cell(table, "C2").dblclick(); await cell(table, "C2").fill("="); + await cell(table, "C2").press("End"); await drag(page, cell(table, "A1"), cell(table, "B1")); await expect(cell(table, "C2")).toHaveValue("=(A1+B1)"); await cell(table, "C2").press("Enter");