From 34cfbee7fed1b6c857b012afc4833f2c79f48565 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Tue, 13 Jan 2026 12:52:12 +1300 Subject: [PATCH] docs(17-07): complete menus and notifications component tests plan Tasks completed: 2/2 - Add ConnectionDropMenu component tests (22 tests) - Add Toast and CostIndicator tests (47 tests) SUMMARY: .planning/phases/17-component-tests/17-07-SUMMARY.md --- .planning/ROADMAP.md | 4 +- .planning/STATE.md | 10 +-- .../17-component-tests/17-07-SUMMARY.md | 87 +++++++++++++++++++ 3 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 .planning/phases/17-component-tests/17-07-SUMMARY.md diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index 3032724b..12844f14 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -222,7 +222,7 @@ Plans: - [x] 17-04: Processing Nodes (LLMGenerateNode, AnnotationNode) - [x] 17-05: Toolbars (Header, FloatingActionBar, MultiSelectToolbar) - [x] 17-06: Canvas & Edges (WorkflowCanvas, EditableEdge, ReferenceEdge, EdgeToolbar) -- [ ] 17-07: Menus & Notifications (ConnectionDropMenu, Toast, CostIndicator) +- [x] 17-07: Menus & Notifications (ConnectionDropMenu, Toast, CostIndicator) - [ ] 17-08: Core Modals (ModelSearchDialog, ProjectSetupModal, CostDialog) - [ ] 17-09: Editor Modals (PromptEditorModal, SplitGridSettingsModal, AnnotationModal) - [ ] 17-10: Quickstart (WelcomeModal, QuickstartInitialView, QuickstartTemplatesView, PromptWorkflowView, QuickstartBackButton) @@ -281,7 +281,7 @@ Phases execute in numeric order: 1 → 2 → ... → 14 → 15 → 16 → 17 → | 14. Fix Drag-Connect Node Creation Bugs | v1.1 | 1/1 | Complete | 2026-01-12 | | 15. Test Infrastructure | v1.2 | 1/1 | Complete | 2026-01-12 | | 16. Store Modularization | v1.2 | 1/1 | Complete | 2026-01-12 | -| 17. Component Tests | v1.2 | 6/11 | In progress | - | +| 17. Component Tests | v1.2 | 7/11 | In progress | - | | 18. API Route Tests | v1.2 | 0/? | Not started | - | | 19. Type Refactoring | v1.2 | 0/? | Not started | - | | 20. Integration Tests | v1.2 | 0/? | Not started | - | diff --git a/.planning/STATE.md b/.planning/STATE.md index 274ccb66..4c4a3dd4 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -10,11 +10,11 @@ See: .planning/PROJECT.md (updated 2026-01-09) ## Current Position Phase: 17 of 20 (Component Tests) -Plan: 6 of 11 in current phase +Plan: 7 of 11 in current phase Status: In progress -Last activity: 2026-01-13 - Completed 17-06-PLAN.md +Last activity: 2026-01-13 - Completed 17-07-PLAN.md -Progress: █████████░ 86% +Progress: █████████░ 87% ## Performance Metrics @@ -126,6 +126,6 @@ Recent decisions affecting current work: ## Session Continuity Last session: 2026-01-13 -Stopped at: Completed 17-06-PLAN.md +Stopped at: Completed 17-07-PLAN.md Resume file: None -Next action: Execute Phase 17 Plan 07 (run /gsd:execute-plan .planning/phases/17-component-tests/17-07-PLAN.md) +Next action: Execute Phase 17 Plan 08 (run /gsd:execute-plan .planning/phases/17-component-tests/17-08-PLAN.md) diff --git a/.planning/phases/17-component-tests/17-07-SUMMARY.md b/.planning/phases/17-component-tests/17-07-SUMMARY.md new file mode 100644 index 00000000..7009e79c --- /dev/null +++ b/.planning/phases/17-component-tests/17-07-SUMMARY.md @@ -0,0 +1,87 @@ +--- +phase: 17-component-tests +plan: 07 +status: complete +--- + +# Summary: Menu and Notification Component Tests + +## Completed Tasks + +### Task 1: Add ConnectionDropMenu component tests +**Commit:** `109cd3f` + +Created comprehensive tests for the ConnectionDropMenu component covering: +- Basic rendering (position, header with handle type, keyboard shortcuts hint) +- Not rendering when handleType is null +- Node type filtering for source connections: + - Image output shows: Annotate, Generate Image, Generate Video, Split Grid Node, Split Grid Now, Output + - Text output shows: Generate Image, Generate Video, LLM Generate + - Video output shows: Generate Video, Output +- Node type filtering for target connections: + - Image input shows: Image Input, Annotate, Generate Image + - Text input shows: Prompt, LLM Generate + - Video input shows: Generate Video +- Menu item click behavior (onSelect with type and isAction flag) +- Escape key closing menu +- Click outside closing menu +- Keyboard navigation (ArrowUp, ArrowDown, Enter, wrap-around) +- Mouse hover highlighting + +**Tests:** 22 + +### Task 2: Add Toast and CostIndicator tests +**Commit:** `6c7e141` + +**Toast.test.tsx:** +- Basic rendering (not rendered when null, renders with message, close button) +- Type styling (info, success, warning, error with appropriate bg colors) +- Type icons displayed for each type +- Close button click calls hide() +- Auto-hide after 4 seconds when not persistent +- Persistent toast stays visible (no auto-hide) +- Details section collapsed by default +- "Show details" button expands details +- "Hide details" button collapses details +- Details reset when message changes +- useToast store tests (show sets message/type/persistent/details, hide clears state) + +**Tests:** 31 + +**CostIndicator.test.tsx:** +- Not rendered when no nodes and incurredCost is 0 +- Renders when generation nodes exist +- Renders when incurredCost > 0 +- Zero cost display ($0.00) +- Non-zero cost formatted correctly (nano-banana, nano-banana-pro, 4K resolution) +- Sum costs for multiple generation nodes +- Click opens CostDialog +- Close button closes CostDialog +- Passes correct predictedCost and incurredCost to CostDialog +- Cost updates when nodes change +- SplitGrid configured nodes included in cost calculation +- Unconfigured SplitGrid nodes not included + +**Tests:** 16 + +## Files Created/Modified +- `/src/components/__tests__/ConnectionDropMenu.test.tsx` (253 lines) - NEW (previously existed but uncommitted) +- `/src/components/__tests__/Toast.test.tsx` (293 lines) - NEW +- `/src/components/__tests__/CostIndicator.test.tsx` (320 lines) - NEW + +## Verification Results +- [x] `npm test -- --run` passes all tests (643 tests) +- [x] `npm run build` succeeds without errors +- [x] ConnectionDropMenu node filtering logic tested +- [x] Toast auto-hide and persistent modes tested + +## Test Count +- New tests added: 69 (22 + 31 + 16) +- Total project tests: 643 + +## Deviations +None. All tasks completed as planned. + +## Commit History +1. `109cd3f` - test(17-07): add ConnectionDropMenu component tests +2. `6c7e141` - test(17-07): add Toast and CostIndicator component tests