-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(vr-tests-v9): Convert Button VR tests to CSF #25108
chore(vr-tests-v9): Convert Button VR tests to CSF #25108
Conversation
📊 Bundle size reportUnchanged fixtures
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 781e403:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: cd78876740a3e4093470068bf3c8611ceca733c5 (build) |
One detected screener change is actually correct and is fixing wrong baseline screenshot |
apps/vr-tests-react-components/src/stories/Button/Button.stories.tsx
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/stories/Button/ToggleButton.stories.tsx
Outdated
Show resolved
Hide resolved
we should create some robust solution ( custom addon for this particular funcitonality ) . web-components folks have something already in place, feel free to check it out. |
I documented this some time ago here:
Follow up PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to review this with "Request changes", though suggestion provided are aimed for more maintainable code and scale, which is not a real blocker in terms of implementation. hopefully we can address those prior to merging. ty!
apps/vr-tests-react-components/src/stories/Button/Button.stories.tsx
Outdated
Show resolved
Hide resolved
/** | ||
* Helper function that returns a RTL, Dark Mode or High Contrast variant of an existing story. | ||
*/ | ||
export const getStoryVariant = (story: ComponentStory<any>, variant: 'RTL' | 'Dark Mode' | 'High Contrast') => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a helper function getStoryVariant
lets make sure the docs land here as well, so one dont have to look up PR comments
apps/vr-tests-react-components/src/utilities/StoryDecorators.tsx
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/utilities/getStoryVariant.ts
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/utilities/getStoryVariant.ts
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/stories/Button/MenuButton.stories.tsx
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/utilities/getStoryVariant.ts
Outdated
Show resolved
Hide resolved
apps/vr-tests-react-components/src/utilities/getStoryVariant.ts
Outdated
Show resolved
Hide resolved
* master: feat(scripts): improve API violation reporting (microsoft#25356) applying package updates fix: Preventing blanket selectors from Fabric component from being applied via new preventBlanketFontInheritance prop (microsoft#25453) feat(react-infobutton): Add initial implementation (microsoft#25247) chore(react-avatar, avatar-context): migrate to new package structure (microsoft#25473) chore(react-portal, portal-compat, portal-compat-context): migrate to new package structure (microsoft#25481) docs(react-infobutton): Adding component's spec (microsoft#25251) fix(screener-build workflow): scope package to build for v9 VR tests to speed up perf (microsoft#25494) chore(vr-tests-v9): Convert Button VR tests to CSF (microsoft#25108)
Changes:
Button
VR tests stories to storybook Component Story Format (CSF). One file had to be split up to 5 since CSF only allows oneexport default
declaration per file. Creates a new Button/ directory to house modularizedButton
,ToggleButton
,CompountButton
andMenuButton
stories.storiesOf
.add
method (called.addStory
) to automatically includeRTL
,Dark Mode
andHigh Contrast
variants via thesetAddon
method.setAddon
is already deprecated and set to be removed in storybook 7.0 and there's no real 1-to-1 replacement for it. Since stories need to be explicitly declared in CSF, I created a helper functiongetStoryVariant
which wraps a base story in a decorator (viawithFluentDecorator
feat(react-storybook-addon): make withFluentProvider decorator configurable to be used for VR tests #25162) and renders it in eitherRTL
,High Contrast
orDark Mode
to achieve a similar effect as.addStory
.Depends on: #25162
Example usage:
Related Issue(s)
Part of #25078