Skip to content

feat(react-conformance-griffel): add custom-style-hook conformance tests and pilot opt ins#36392

Open
PaulGMardling wants to merge 8 commits into
microsoft:masterfrom
PaulGMardling:feat/custom-style-hook-conformance
Open

feat(react-conformance-griffel): add custom-style-hook conformance tests and pilot opt ins#36392
PaulGMardling wants to merge 8 commits into
microsoft:masterfrom
PaulGMardling:feat/custom-style-hook-conformance

Conversation

@PaulGMardling

Copy link
Copy Markdown
Contributor

Previous Behavior

There was no reusable conformance assertion to verify that v9 components call useCustomStyleHook_unstable(...) and invoke the returned hook with component state.
As a result, custom style hook wiring regressions could slip through unless caught manually.

New Behavior

This PR adds a new reusable Griffel conformance test: component-calls-custom-style-hook.

The test validates that:

  • the component calls useCustomStyleHook_unstable with the expected hook key
  • the returned hook is invoked with component state

This PR also enables pilot coverage for:

  • Button
  • Card
  • MenuItemLink

Validation run:

  • yarn nx run react-conformance-griffel:test --passWithNoTests=true
  • yarn nx run react-button:test --testPathPatterns=Button.test.tsx
  • yarn nx run react-card:test --testPathPatterns=Card.test.tsx
  • yarn nx run react-menu:test --testPathPatterns=MenuItemLink.test.tsx

Related Issue(s)

@PaulGMardling PaulGMardling changed the title Feat/custom style hook conformance feat(react-conformance-griffel): add custom-style-hook conformance tests and pilot opt ins Jul 13, 2026
@github-actions github-actions Bot added the CI label Jul 13, 2026
@github-actions

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

Comment thread .github/workflows/pr.yml
yarn nx format:check --base origin/master

- name: build, test, lint, test-ssr (affected)
run: |

@github-actions github-actions Bot Jul 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 729 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 512 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 31 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 67 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 132 Changed
vr-tests-react-components/TagPicker 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png 635 Changed
vr-tests/react-charting-GaugeChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-GaugeChart.Basic.default.chromium.png 2 Changed
vr-tests/react-charting-LineChart 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-LineChart.Multiple - RTL.default.chromium.png 200 Changed
vr-tests/react-charting-LineChart.Multiple.default.chromium.png 192 Changed
vr-tests/react-charting-LineChart.Multiple - Dark Mode.default.chromium.png 181 Changed
vr-tests/react-charting-LineChart.Events.default.chromium.png 17 Changed
vr-tests/react-charting-MultiStackBarChart 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute - RTL.default.chromium.png 343 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_PartToWhole - RTL.default.chromium.png 343 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute - Dark Mode.default.chromium.png 363 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_PartToWhole - Dark Mode.default.chromium.png 363 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

@github-actions github-actions Bot removed the CI label Jul 14, 2026
@PaulGMardling
PaulGMardling force-pushed the feat/custom-style-hook-conformance branch 3 times, most recently from 54c9639 to 1f9fb85 Compare July 15, 2026 12:20
@PaulGMardling
PaulGMardling marked this pull request as ready for review July 15, 2026 14:16
@PaulGMardling
PaulGMardling force-pushed the feat/custom-style-hook-conformance branch from f6240cd to b3a31a4 Compare July 15, 2026 14:16
@PaulGMardling PaulGMardling self-assigned this Jul 16, 2026

@Hotell Hotell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should live in react-conformance it has nothing specific about griffel. the core is indeed confusing as it is used in both v8 and v9. in ideal world the architecture should be ( this is out of scope of this PR ofc )

      core 
     /         \
v9 rules        v8 rules   
  /
griffel rules

/** Prefix for the classname, if not `fui-` */
prefix?: string;
};
'component-calls-custom-style-hook'?: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't exist , the rule you're implementing is part of griffel conformance where it's id definition lives.

Component: MenuItemLink,
displayName: 'MenuItemLink',
testOptions: {
'component-calls-custom-style-hook': {},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is being enabled without providing the extra rules so its a noop

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const element = React.createElement(Component, { ...testInfo.requiredProps } as any);
const expectedHookName =
testOptions?.[CUSTOM_STYLE_HOOK_CALLED_TEST_NAME]?.hookName ?? `use${testInfo.displayName}Styles_unstable`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the use case of providing the hook naming via isConformant configuration in user land ? can't we enforce/rely only on the computed hook name -> use${testInfo.displayName}Styles_unstable ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add conformance test for custom style hooks

2 participants