/** * The routine form's three controls. * * All three exist to undo the same mistake: a creation form that spent its first screen on * things that were optional, duplicated, or unusable at scale. * * * **Templates** were a section of nine cards above the Name field, so an optional * shortcut read as a required step. They are one dropdown now, and these tests hold it * shut until asked. * * **The four action types** were a second card grid directly under the templates, and the * two overlapped — picking "Morning news" and then "Today's news" is the same decision * twice. They are suggestions under a single task field now. * * **Run with** was a native `: on an install with forty personas, typing is the // only way anyone finds the one they want. renderPicker() fireEvent.click(screen.getByTestId('routine-target-trigger')) fireEvent.change(screen.getByTestId('routine-target-search'), { target: { value: 'marcus' } }) expect(screen.getByTestId('routine-target-persona-p2')).toBeTruthy() expect(screen.queryByTestId('routine-target-persona-p1')).toBeNull() expect(screen.queryByTestId('routine-target-assistant')).toBeNull() }) it('picks a persona and closes', () => { const { onChange } = renderPicker() fireEvent.click(screen.getByTestId('routine-target-trigger')) fireEvent.click(screen.getByTestId('routine-target-persona-p1')) expect(onChange).toHaveBeenCalledWith({ type: 'persona', project_id: 'p1' }) expect(screen.queryByTestId('routine-target-menu')).toBeNull() }) it('shows the name of the chosen persona on the trigger', () => { renderPicker({ type: 'persona', project_id: 'p2' }) expect(screen.getByTestId('routine-target-trigger')).toHaveTextContent('Marcus Chen') }) it('carries the template’s advice as one line, not a panel', () => { renderPicker({ type: 'assistant' }, 'Stand-up prep works best with a project.') expect(screen.getByTestId('routine-target-hint')).toHaveTextContent('works best with a project') }) it('says nothing when a search matches nothing', () => { renderPicker() fireEvent.click(screen.getByTestId('routine-target-trigger')) fireEvent.change(screen.getByTestId('routine-target-search'), { target: { value: 'zzzz' } }) expect(screen.getByTestId('routine-target-empty')).toHaveTextContent('Nothing matches') }) })