Conversation
Move Dialog's Jest render/interaction tests into co-located stories (state stories + play interactions, a11y via addon-vitest) and keep only the ref-forwarding contracts as a co-located node test. Delete the old Jest suite and the styleguide story/mdx; glob gamut stories in Storybook. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rendering stories with isOpen:true stacked every open dialog on the autodocs page. Render a trigger button and open the dialog in play instead; a11y still covers the open state (axe runs after play). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire the story render's onRequestClose to actually close the dialog so confirm/cancel/close/escape work when clicked manually. Inline the render as a named function so "Show code" reflects real usage. Restore the styleguide demo stories (incl. FocusManagement) and consolidate the interaction coverage into one Dismissal play; DRY the open step onto the meta play. Add play assertions for the custom-close, close-button-focus, and container-focus behaviors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stories co-located in gamut/src broke the library build: tsc compiled them and failed on Storybook-only imports. Exclude *.stories.* from tsconfig.lib.json (matching tests) and add a tsconfig.storybook.json (bundler resolution + ~storybook paths) so stories still type-check. Also add ~storybook/* aliases so gamut stories can import them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@skillsoft/eslint-plugin-gamut
@skillsoft/gamut
@skillsoft/gamut-agent-tools
@skillsoft/gamut-icons
@skillsoft/gamut-illustrations
@skillsoft/gamut-patterns
@skillsoft/gamut-styles
@skillsoft/gamut-tests
@skillsoft/variance
commit: |
LinKCoding
approved these changes
Oct 2, 2026
LinKCoding
left a comment
Contributor
There was a problem hiding this comment.
Works great!
Tests pass and the story loads and tests work and pass there too.
Talked through DM re: the "Run test" button that should be ticketed out.
Two things come to mind:
- keeping the tests and stories in a dedicated folder makes sense to me since they're kind of auxiliary, but also might feel more cluttered -- it'd be good to get consensus on this since redoing all this work is a lit annoying
- Doesn't have to be this ticket, but re-using the same claude context would prob help in having it write a script to automate this moving (that's what it'd likely do anyway but 🤷 wouldn't wanna burn tokens just for re-organizing files)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First component in the Storybook testing revamp, ported end-to-end. Dialog's Jest render/interaction tests now live as co-located Storybook stories in
packages/gamut(run as browser tests viaaddon-vitest, with axe a11y), and only the ref-forwarding contracts remain as a co-located node test. The old Jest suite and the styleguide story + mdx are removed.Changes
Tests → stories
packages/gamut/src/Modals/Dialog.stories.tsx— co-located stories titledMolecules/Modals/Dialog. All six original styleguide demo stories are preserved (Default,Danger,DarkMode,CustomClose,CloseButtonCustomization,FocusManagement), plus one behavioralDismissalstory. Each story renders an "Open dialog" trigger and opens the dialog inside itsplay(the render'sonRequestCloseis wired to actually close it, so confirm/cancel/close/Escape work when clicked manually too). The dialog is queried viascreensince it portals outside the story canvas, and interactions usefn()spies. The autodocs page stays clean because it doesn't auto-runplay, while a11y still covers the open dialog since axe runs afterplay.packages/gamut/src/Modals/Dialog.test.tsx— node Jest test co-located next to the component, keeping only the two ref-forwarding contracts (closeButtonProps.ref,containerFocusRef) that a browserplaycan't assert through accessible queries.packages/gamut/src/Modals/__tests__/Dialog.test.tsx(old Jest suite) and the styleguideDialog.stories.tsx+Dialog.mdx.Storybook / build config for co-located stories
packages/.storybook/main.ts— globs gamut stories (../gamut/src) alongside styleguide, and adds~storybook/blocks+~storybook/argTypesVite aliases (gamut stories use~storybook/*; styleguide keeps~styleguide/*).packages/gamut/tsconfig.lib.json— excludes**/*.stories.*so the library build doesn't compile/emit stories (they import Storybook-only modules).packages/gamut/tsconfig.storybook.json(new) +tsconfig.json— a bundler-resolution project that type-checks stories, with~storybook/*paths. Mirrors howstyleguidetype-checks its stories (editor / type-aware ESLint; not a CItscgate).Test mapping (old
it()→ new home)DefaultisOpenfalse →Dismissal(asserted after each close)DismissalDismissalDismissal(queries the close button by that name)CloseButtonCustomizationcloseButtonProps.refforwarded → nodeDialog.test.tsxcontainerFocusRefforwarded → nodeDialog.test.tsxThe node test stays Jest for now — the Vitest-node project is separate infra.
Coverage added beyond the old suite
CustomCloseasserts the in-content custom close button dismisses the dialog.CloseButtonCustomizationasserts "Focus Close Button" moves focus to the close button (closeButtonRef.focus()).FocusManagementasserts "Focus Dialog Container" moves focus to the dialog (containerFocusRef.focus()).Dismissaladds Escape-to-close, which jsdom couldn't exercise but the real browser can.Testing
yarn test:stories gamut/src/Modals/Dialog.stories→ 7 stories pass, incl. a11yyarn nx run gamut:test→ node ref contracts passyarn nx run gamut:build→ library build passes (stories excluded)yarn start:storybook→ Molecules/Modals/Dialog, confirm the Docs page shows trigger buttons (no stacked dialogs), then open each story and exercise it (confirm / cancel / close button / Escape close the dialog; custom close and focus buttons behave) with the Accessibility panel cleanPR Checklist