meal eaten checkbox
This commit is contained in:
@@ -96,3 +96,31 @@ test("removing a meal from a list removes its ingredients", async ({ page }) =>
|
||||
await expect(page.locator(".item-row").filter({ hasText: "Tomato" })).toHaveCount(0);
|
||||
await expect(row).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("a meal can be checked off without removing it from the list", async ({ page }) => {
|
||||
await registerAndLogin(page, "alice@example.com");
|
||||
await createMealWithIngredients(page, "Spaghetti Bolognese", [{ name: "Penne" }]);
|
||||
await createList(page, "Weekly shop");
|
||||
|
||||
await page.click(".add-meal-button");
|
||||
const picker = page.locator(".meal-picker-backdrop");
|
||||
await picker.locator(".meal-picker-button").filter({ hasText: "Spaghetti Bolognese" }).click();
|
||||
|
||||
const panel = page.locator("#list-meals-panel");
|
||||
const row = panel.locator(".list-meal-row").filter({ hasText: "Spaghetti Bolognese" });
|
||||
await expect(row).toBeVisible();
|
||||
await expect(row.locator(".list-meal-check-button")).not.toHaveClass(/is-.*checked/);
|
||||
|
||||
// Check the meal off as eaten.
|
||||
await row.locator(".list-meal-check-button").click();
|
||||
await expect(row).toHaveClass(/is-checked/);
|
||||
await expect(row.locator(".list-meal-check-button")).toHaveText("✓");
|
||||
// The meal is still on the list, not removed.
|
||||
await expect(row).toBeVisible();
|
||||
await expect(page.locator(".item-row").filter({ hasText: "Penne" })).toBeVisible();
|
||||
|
||||
// Unchecking restores it.
|
||||
await row.locator(".list-meal-check-button").click();
|
||||
await expect(row).not.toHaveClass(/is-checked/);
|
||||
await expect(row).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user