Improve calculator progress tracking and responsive layout
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
3f86d863ac
commit
51853245ad
15 changed files with 329 additions and 75 deletions
|
|
@ -54,6 +54,49 @@ test("parent edits recalculate descendants and survive reload; deleting a parent
|
|||
await expect(tool.getByText("Aucun résultat enregistré.", { exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("current values are subtracted from totals and kept during recalculation", async ({ page }) => {
|
||||
const tool = await setup(page);
|
||||
const expression = tool.getByRole("textbox", { name: "Calcul", exact: true });
|
||||
const current = tool.getByLabel("Actuel", { exact: true });
|
||||
const totalLabel = tool.getByText("Total", { exact: true });
|
||||
await expect(current).toHaveCount(0);
|
||||
await expect(totalLabel).toHaveCount(0);
|
||||
const subtractCurrent = tool.getByRole("button", { name: "Soustraire l'actuel", exact: true });
|
||||
await expect(subtractCurrent).toHaveAttribute("aria-pressed", "false");
|
||||
await subtractCurrent.click();
|
||||
await expect(subtractCurrent).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(current).toBeFocused();
|
||||
await expect(totalLabel).toBeVisible();
|
||||
const expressionBounds = await expression.boundingBox();
|
||||
const currentBounds = await current.boundingBox();
|
||||
expect(currentBounds.x).toBeCloseTo(expressionBounds.x, 0);
|
||||
expect(currentBounds.width).toBeCloseTo(expressionBounds.width, 0);
|
||||
await expression.fill("10");
|
||||
await current.fill("2");
|
||||
await tool.getByLabel("Libellé", { exact: true }).fill("Parent");
|
||||
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "8");
|
||||
await tool.getByRole("button", { name: "Enregistrer", exact: true }).click();
|
||||
await tool.getByRole("button", { name: "Ajouter un calcul enfant Parent", exact: true }).click();
|
||||
await expression.fill("base * 10");
|
||||
await subtractCurrent.click();
|
||||
await current.fill("20");
|
||||
await tool.getByLabel("Libellé", { exact: true }).fill("Child");
|
||||
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "60");
|
||||
await tool.getByRole("button", { name: "Mettre à jour", exact: true }).click();
|
||||
await entry(tool, "Parent").getByTitle("Modifier", { exact: true }).click();
|
||||
await expect(current).toHaveValue("2");
|
||||
await expression.fill("20");
|
||||
await tool.getByRole("button", { name: "Mettre à jour", exact: true }).click();
|
||||
await expect(entry(tool, "Child").locator("strong")).toHaveAttribute("aria-label", "160");
|
||||
await page.reload();
|
||||
await entry(tool, "Child").getByTitle("Modifier", { exact: true }).click();
|
||||
await expect(current).toHaveValue("20");
|
||||
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "160");
|
||||
await subtractCurrent.click();
|
||||
await expect(current).toHaveCount(0);
|
||||
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "180");
|
||||
});
|
||||
|
||||
test("reset clears only the draft, new calculation returns to root, and clipboard and scroll preferences persist", async ({ page, context }) => {
|
||||
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
||||
const tool = await setup(page);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue