feat: add enable/disable toggle for chore scheduling in ScheduleModal
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m39s

- Introduced a toggle button to enable or disable chores in the scheduler.
- The toggle will be available in both types of schedulers.
- Added UI design proposal and considerations for mobile dimensions.
- Included E2E tests to ensure toggle state persistence and correct behavior in child view.
This commit is contained in:
2026-03-20 16:42:13 -04:00
parent db6e0a7ce8
commit ef9cb01d92
45 changed files with 3543 additions and 232 deletions

View File

@@ -2,11 +2,32 @@
// Merged from kindness-convert-default.spec.ts and kindness-delete-default.spec.ts.
// Both tests touch "Be good for the day" so they MUST run serially.
import { test, expect } from '@playwright/test'
import { test, expect, type APIRequestContext } from '@playwright/test'
const BACKEND = 'http://localhost:5000'
async function cleanupBeGoodTasks(request: APIRequestContext): Promise<void> {
const res = await request.get(`${BACKEND}/task/list`)
if (!res.ok()) return
const { tasks }: { tasks: Array<{ id: string; name: string; user_id: string | null }> } =
await res.json()
for (const task of tasks) {
if (
task.user_id !== null &&
(task.name === 'Be good today (edited)' || task.name === 'Be good for the day')
) {
await request.delete(`${BACKEND}/task/${task.id}`)
}
}
}
test.describe('Default kindness act management', () => {
test.describe.configure({ mode: 'serial' })
test.beforeEach(async ({ request }) => {
await cleanupBeGoodTasks(request)
})
test('Convert a default kindness act to a user item by editing', async ({ page }) => {
await page.goto('/parent/tasks/chores')
await page.click('text=Kindness Acts')
@@ -45,23 +66,6 @@ test.describe('Default kindness act management', () => {
await page.goto('/parent/tasks/chores')
await page.getByText('Kindness Acts').click()
// Cleanup: if a previous run left a modified 'Be good for the day' (with delete icon), remove it first
while (
(await page
.getByText('Be good for the day', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.count()) > 0
) {
await page
.getByText('Be good for the day', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.first()
.click()
await page.getByRole('button', { name: 'Delete', exact: true }).click()
}
// 1. Verify 'Be good for the day' is the system default (visible, no delete icon)
await expect(page.getByText('Be good for the day', { exact: true })).toBeVisible()
await expect(

View File

@@ -1,27 +0,0 @@
// spec: frontend/vue-app/e2e/plans/parent-item-management.plan.md
// seed: e2e/seed.spec.ts
import { test, expect } from '@playwright/test'
test('Convert a default penalty to a user item by editing', async ({ page }) => {
await page.goto('/parent/tasks/chores')
await page.click('text=Penalties')
// locate default penalty
await expect(page.locator('text=Fighting')).toBeVisible()
await expect(page.locator('text=Fighting >> .. >> button[aria-label="Delete item"]')).toHaveCount(
0,
)
// edit it (click the item itself)
await page.getByText('Fighting', { exact: true }).click()
await page.locator('#name').fill('Fighting (custom)')
await page.locator('#points').fill('15')
await expect(page.getByRole('button', { name: 'Save' })).toBeEnabled()
await page.getByRole('button', { name: 'Save' }).click()
// now should have delete option (match the updated name exactly)
await expect(
page
.getByText('Fighting (custom)', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]'),
).toBeVisible()
})

View File

@@ -2,32 +2,33 @@
// Merged from penalty-convert-default.spec.ts and penalty-delete-default.spec.ts.
// Both tests touch "Fighting" so they MUST run serially.
import { test, expect } from '@playwright/test'
import { test, expect, type APIRequestContext } from '@playwright/test'
const BACKEND = 'http://localhost:5000'
async function cleanupFightingTasks(request: APIRequestContext): Promise<void> {
const res = await request.get(`${BACKEND}/task/list`)
if (!res.ok()) return
const { tasks }: { tasks: Array<{ id: string; name: string; user_id: string | null }> } =
await res.json()
for (const task of tasks) {
if (task.user_id !== null && (task.name === 'Fighting (custom)' || task.name === 'Fighting')) {
await request.delete(`${BACKEND}/task/${task.id}`)
}
}
}
test.describe('Default penalty management', () => {
test.describe.configure({ mode: 'serial' })
test.beforeEach(async ({ request }) => {
await cleanupFightingTasks(request)
})
test('Convert a default penalty to a user item by editing', async ({ page }) => {
await page.goto('/parent/tasks/chores')
await page.click('text=Penalties')
// Cleanup: delete any leftover 'Fighting (custom)' from a prior run
while (
(await page
.getByText('Fighting (custom)', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.count()) > 0
) {
await page
.getByText('Fighting (custom)', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.first()
.click()
await page.getByRole('button', { name: 'Delete', exact: true }).click()
}
// locate default penalty
await expect(page.getByText('Fighting', { exact: true })).toBeVisible()
await expect(
@@ -67,23 +68,6 @@ test.describe('Default penalty management', () => {
await page.goto('/parent/tasks/chores')
await page.getByText('Penalties').click()
// Cleanup: if a previous run left a modified 'Fighting' (with delete icon), remove it first
while (
(await page
.getByText('Fighting', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.count()) > 0
) {
await page
.getByText('Fighting', { exact: true })
.locator('..')
.locator('button[aria-label="Delete item"]')
.first()
.click()
await page.getByRole('button', { name: 'Delete', exact: true }).click()
}
// 1. Verify 'Fighting' is the system default (visible, no delete icon)
await expect(page.getByText('Fighting', { exact: true })).toBeVisible()
await expect(