name: qti-interactions-story-authoring description: Author and refactor Storybook stories for qti-interactions using the required docs/split structure, query policy, and interaction-focused testing boundaries.
QTI Interactions Story Authoring
When To Use
- Adding or refactoring stories in
packages/qti-interactions/src/components/**. - Enforcing taxonomy split and query policy.
Required Structure
- One main docs story per component at root:
qti-*-interaction.stories.ts
- Split stories under
stories/using taxonomy:.a11y,.api,.behavior,.config,.correctresponse,.dom,.forms,.theming,.validation,.vocabulary
Main Docs Story Rules
- Main docs story is the only place allowed to use:
getStorybookHelpers(...)tags: ['autodocs']
Query Rules
- Prefer testing-library and shadow-dom testing queries:
getByRole,getByLabelText,getByPlaceholderText,getByText,getByDisplayValue,getByAltText,getByTitle,getByTestId
- Avoid
querySelector(...)andshadowRoot?.querySelector(...)unless no semantic alternative exists.
Test Scope
- Validate only the target interaction behavior in a story.
- Move cross-component integration behavior to dedicated integration stories/tests.
Styling/Theming Guardrails
- Functional layout in local
*.styles.ts. - No semantic
qti-baseclasses in interaction component styles. - Visual theming in
packages/qti-theme/src/styles/qti-components/qti-interactions.css.
Implementation Checklist
- Create/update root docs story.
- Add or update split stories under
stories/. - Convert selector-based assertions to query-based assertions.
- Verify no extra
autodocsorgetStorybookHelpersusage in split stories.