feat(KB-125): add planning mode checkbox to new task flow

- Add planning mode checkbox to NewTaskModal with onPlanGenerated callback
- Wire up planning mode flow in App.tsx to open modal after task creation
- Add initialPlan prop to PlanningModeModal with auto-start logic
- Add comprehensive tests for planning mode checkbox flow in both modals
- Include changeset for the planning mode checkbox fix
This commit is contained in:
gsxdsm
2026-03-30 07:57:53 -07:00
parent ea5a34f7cf
commit 3c9901b2cf
6 changed files with 255 additions and 8 deletions

View File

@@ -158,6 +158,57 @@ describe("PlanningModeModal", () => {
expect(screen.getByText(/Build a user authentication/)).toBeDefined();
});
it("auto-starts planning when initialPlan prop is provided", async () => {
mockStartPlanning.mockResolvedValue({
sessionId: "session-123",
currentQuestion: mockQuestion,
summary: null,
});
render(
<PlanningModeModal
isOpen={true}
onClose={mockOnClose}
onTaskCreated={mockOnTaskCreated}
tasks={mockTasks}
initialPlan="Build a login system from new task dialog"
/>
);
// Wait for startPlanning to be called
await waitFor(() => {
expect(mockStartPlanning).toHaveBeenCalledWith("Build a login system from new task dialog");
});
// Should transition to question view
await waitFor(() => {
expect(screen.getByText("What is the scope?")).toBeDefined();
});
});
it("sets initial plan text in textarea when initialPlan prop is provided", async () => {
mockStartPlanning.mockResolvedValue({
sessionId: "session-123",
currentQuestion: mockQuestion,
summary: null,
});
render(
<PlanningModeModal
isOpen={true}
onClose={mockOnClose}
onTaskCreated={mockOnTaskCreated}
tasks={mockTasks}
initialPlan="Pre-filled plan from new task"
/>
);
// The auto-start should happen with the initial plan
await waitFor(() => {
expect(mockStartPlanning).toHaveBeenCalledWith("Pre-filled plan from new task");
});
});
});
describe("Planning flow", () => {