Extracts two pure helpers out of Svelte components so they can be
exercised without the reactive runtime, and adds component tests for
ConfirmDialog's Escape-handling behavior.
- apps/tauri/src/lib/grouping.ts (new): `groupTasksByDate` lifted out of
the `groupedPendingTasks` $derived in the app store.
- apps/tauri/src/lib/paths.ts (new): `workspaceNameFromPath` lifted out
of SetupScreen.handleOpen.
- apps/tauri/src/lib/grouping.test.ts: 8 cases — "No Date" placed last
(regression), full bucket ordering, empty input, within-bucket
stable sort, earlier-today stays in Today, multi-task same-day,
No Date preserves insertion order.
- apps/tauri/src/lib/paths.test.ts: 8 cases — POSIX/Windows/mixed
separators, trailing slash regression ("…/Tasks/" → "Tasks"), empty
and root-only fallback, names with spaces.
- apps/tauri/src/lib/components/ConfirmDialog.test.ts: 6 cases —
renders message/detail/custom confirm text, Cancel/Confirm fire the
right callbacks, Escape calls oncancel and does NOT reach an outer
window listener (regression), non-Escape keys are ignored, and the
module-level open-count increments/decrements correctly (including
when two dialogs are mounted at once).
Test harness: Vitest + jsdom + @testing-library/svelte. `npm test`
runs the suite; `resolve.conditions` is set to "browser" under VITEST
so Svelte resolves its client entry and mount() works.
23/23 tests pass. cargo check, cargo test -p onyx-core (162/162),
and npm run build all still green.
34 lines
815 B
JSON
34 lines
815 B
JSON
{
|
|
"name": "onyx",
|
|
"private": true,
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"tauri": "tauri",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest"
|
|
},
|
|
"devDependencies": {
|
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
"@tailwindcss/vite": "^4.0.0",
|
|
"@tauri-apps/cli": "^2.0.0",
|
|
"@testing-library/jest-dom": "^6.9.1",
|
|
"@testing-library/svelte": "^5.3.1",
|
|
"@testing-library/user-event": "^14.6.1",
|
|
"jsdom": "^29.0.2",
|
|
"svelte": "^5.0.0",
|
|
"tailwindcss": "^4.0.0",
|
|
"typescript": "^5.6.0",
|
|
"vite": "^6.0.0",
|
|
"vitest": "^4.1.4"
|
|
},
|
|
"dependencies": {
|
|
"@tauri-apps/api": "^2.0.0",
|
|
"@tauri-apps/plugin-dialog": "^2.0.0",
|
|
"@tauri-apps/plugin-os": "^2.3.2"
|
|
}
|
|
}
|