Add conformance tests for static classnames#21960
Conversation
|
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 fcc4c52:
|
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 80746a7f3462c2fa4ff15a92d6e196c67d652f6a (build) |
Perf Analysis (
|
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| SegmentMinimalPerf.default | 344 | 325 | 1.06:1 |
| AvatarMinimalPerf.default | 201 | 192 | 1.05:1 |
| ButtonMinimalPerf.default | 175 | 166 | 1.05:1 |
| ListWith60ListItems.default | 634 | 605 | 1.05:1 |
| TreeWith60ListItems.default | 174 | 165 | 1.05:1 |
| HeaderMinimalPerf.default | 365 | 350 | 1.04:1 |
| IconMinimalPerf.default | 603 | 579 | 1.04:1 |
| TreeMinimalPerf.default | 780 | 750 | 1.04:1 |
| ButtonOverridesMissPerf.default | 1636 | 1589 | 1.03:1 |
| ChatMinimalPerf.default | 726 | 708 | 1.03:1 |
| FlexMinimalPerf.default | 287 | 279 | 1.03:1 |
| LoaderMinimalPerf.default | 671 | 651 | 1.03:1 |
| RadioGroupMinimalPerf.default | 430 | 418 | 1.03:1 |
| TableManyItemsPerf.default | 1849 | 1796 | 1.03:1 |
| TextMinimalPerf.default | 339 | 329 | 1.03:1 |
| ButtonSlotsPerf.default | 528 | 520 | 1.02:1 |
| ChatWithPopoverPerf.default | 370 | 364 | 1.02:1 |
| CheckboxMinimalPerf.default | 2572 | 2525 | 1.02:1 |
| DropdownManyItemsPerf.default | 646 | 635 | 1.02:1 |
| DropdownMinimalPerf.default | 2921 | 2863 | 1.02:1 |
| HeaderSlotsPerf.default | 728 | 716 | 1.02:1 |
| PopupMinimalPerf.default | 600 | 591 | 1.02:1 |
| StatusMinimalPerf.default | 638 | 623 | 1.02:1 |
| AttachmentMinimalPerf.default | 150 | 148 | 1.01:1 |
| CardMinimalPerf.default | 524 | 519 | 1.01:1 |
| DatepickerMinimalPerf.default | 5299 | 5254 | 1.01:1 |
| ImageMinimalPerf.default | 345 | 343 | 1.01:1 |
| ItemLayoutMinimalPerf.default | 1137 | 1129 | 1.01:1 |
| MenuMinimalPerf.default | 817 | 809 | 1.01:1 |
| MenuButtonMinimalPerf.default | 1610 | 1596 | 1.01:1 |
| RosterPerf.default | 1091 | 1077 | 1.01:1 |
| SplitButtonMinimalPerf.default | 4123 | 4072 | 1.01:1 |
| TooltipMinimalPerf.default | 977 | 964 | 1.01:1 |
| AlertMinimalPerf.default | 264 | 265 | 1:1 |
| AnimationMinimalPerf.default | 525 | 524 | 1:1 |
| CarouselMinimalPerf.default | 457 | 455 | 1:1 |
| ChatDuplicateMessagesPerf.default | 293 | 294 | 1:1 |
| DialogMinimalPerf.default | 730 | 727 | 1:1 |
| FormMinimalPerf.default | 386 | 385 | 1:1 |
| InputMinimalPerf.default | 1228 | 1227 | 1:1 |
| LabelMinimalPerf.default | 362 | 362 | 1:1 |
| ListMinimalPerf.default | 494 | 493 | 1:1 |
| ListNestedPerf.default | 525 | 524 | 1:1 |
| ProviderMergeThemesPerf.default | 1634 | 1641 | 1:1 |
| ProviderMinimalPerf.default | 1058 | 1059 | 1:1 |
| ReactionMinimalPerf.default | 365 | 365 | 1:1 |
| TableMinimalPerf.default | 384 | 383 | 1:1 |
| AccordionMinimalPerf.default | 141 | 142 | 0.99:1 |
| EmbedMinimalPerf.default | 3943 | 3987 | 0.99:1 |
| ListCommonPerf.default | 611 | 615 | 0.99:1 |
| SliderMinimalPerf.default | 1584 | 1596 | 0.99:1 |
| CustomToolbarPrototype.default | 3872 | 3893 | 0.99:1 |
| ToolbarMinimalPerf.default | 891 | 903 | 0.99:1 |
| VideoMinimalPerf.default | 618 | 622 | 0.99:1 |
| BoxMinimalPerf.default | 327 | 334 | 0.98:1 |
| GridMinimalPerf.default | 315 | 322 | 0.98:1 |
| PortalMinimalPerf.default | 163 | 167 | 0.98:1 |
| SkeletonMinimalPerf.default | 322 | 328 | 0.98:1 |
| TextAreaMinimalPerf.default | 463 | 473 | 0.98:1 |
| DividerMinimalPerf.default | 331 | 340 | 0.97:1 |
| RefMinimalPerf.default | 225 | 232 | 0.97:1 |
| AttachmentSlotsPerf.default | 1000 | 1044 | 0.96:1 |
| LayoutMinimalPerf.default | 348 | 362 | 0.96:1 |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| BaseButton | mount | 925 | 932 | 5000 | |
| Breadcrumb | mount | 2683 | 2731 | 1000 | |
| Checkbox | mount | 1526 | 1508 | 5000 | |
| CheckboxBase | mount | 1286 | 1315 | 5000 | |
| ChoiceGroup | mount | 4786 | 4737 | 5000 | |
| ComboBox | mount | 983 | 985 | 1000 | |
| CommandBar | mount | 10883 | 10419 | 1000 | |
| ContextualMenu | mount | 12891 | 11926 | 1000 | |
| DefaultButton | mount | 1228 | 1188 | 5000 | |
| DetailsRow | mount | 3809 | 3862 | 5000 | |
| DetailsRowFast | mount | 3852 | 3902 | 5000 | |
| DetailsRowNoStyles | mount | 3645 | 3663 | 5000 | |
| Dialog | mount | 2238 | 2244 | 1000 | |
| DocumentCardTitle | mount | 174 | 179 | 1000 | |
| Dropdown | mount | 3344 | 3413 | 5000 | |
| FocusTrapZone | mount | 1821 | 1830 | 5000 | |
| FocusZone | mount | 1844 | 1848 | 5000 | |
| IconButton | mount | 1796 | 1785 | 5000 | |
| Label | mount | 362 | 360 | 5000 | |
| Layer | mount | 3017 | 3028 | 5000 | |
| Link | mount | 466 | 474 | 5000 | |
| MenuButton | mount | 1517 | 1507 | 5000 | |
| MessageBar | mount | 2117 | 2153 | 5000 | |
| Nav | mount | 3344 | 3418 | 1000 | |
| OverflowSet | mount | 1112 | 1143 | 5000 | |
| Panel | mount | 2167 | 2194 | 1000 | |
| Persona | mount | 869 | 862 | 1000 | |
| Pivot | mount | 1482 | 1466 | 1000 | |
| PrimaryButton | mount | 1333 | 1340 | 5000 | |
| Rating | mount | 7715 | 7747 | 5000 | |
| SearchBox | mount | 1328 | 1330 | 5000 | |
| Shimmer | mount | 2543 | 2539 | 5000 | |
| Slider | mount | 1935 | 1995 | 5000 | |
| SpinButton | mount | 5108 | 5417 | 5000 | |
| Spinner | mount | 454 | 450 | 5000 | |
| SplitButton | mount | 3255 | 3268 | 5000 | |
| Stack | mount | 526 | 523 | 5000 | |
| StackWithIntrinsicChildren | mount | 2331 | 2281 | 5000 | |
| StackWithTextChildren | mount | 5309 | 5331 | 5000 | |
| SwatchColorPicker | mount | 11731 | 11773 | 5000 | |
| TagPicker | mount | 2685 | 2722 | 5000 | |
| TeachingBubble | mount | 95987 | 96535 | 5000 | |
| Text | mount | 429 | 429 | 5000 | |
| TextField | mount | 1388 | 1427 | 5000 | |
| ThemeProvider | mount | 1190 | 1200 | 5000 | |
| ThemeProvider | virtual-rerender | 679 | 670 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1901 | 1891 | 5000 | |
| Toggle | mount | 823 | 808 | 5000 | |
| buttonNative | mount | 130 | 126 | 5000 |
be4c59e to
33f7bc0
Compare
| const { testOptions = {} } = testInfo; | ||
| const staticClassNameVariants = testOptions['has-static-classnames'] ?? [{ props: {} }]; | ||
|
|
||
| for (const staticClassNames of staticClassNameVariants) { |
There was a problem hiding this comment.
This test is a bit awkward as we need to support the idea of "variant" ways to render a component for components like Avatar that have mutually exclusive slots. In Avatar when an icon is rendered in the icon slot the initials slot is not rendered and neither is the initials class name.
| } | ||
| }); | ||
|
|
||
| it('has static classnames in correct format (component-has-static-classnames-object)', () => { |
There was a problem hiding this comment.
This test can be dropped once we support a minimum of TS4.1 as we can re-write the SlotClassNames<T> type to enforce this with TS:
export type SlotClassNames<Component, Slots> = {
[SlotName in keyof Slots]-?: SlotName extends 'root'
? `fui-${string & Component}`
: `fui-${string & Component}__${string & SlotName}`;
};There was a problem hiding this comment.
@ling1726 This test validates that the slot name is in the class name. This can also be accomplished with TS which is preferrable imo but I believe it requires a newer version of TS that exceeds our minimum supported version.
| isConformant({ | ||
| Component: Avatar, | ||
| displayName: 'Avatar', | ||
| testOptions: { |
There was a problem hiding this comment.
this feels pretty verbose. is there a way to make this test more simple?
There was a problem hiding this comment.
I can think about it some more and I'm open to suggestions. The issue is that Avatar conditionally renders slots based on other slots -- initials is not rendered if there is an icon.
There was a problem hiding this comment.
Could we render all the avatars with these props? (pass as requiredProps)
This test is no longer applicable to react-toolbar as the `toolbarClassName` export has been removed. This component has not be exported as part of the public API so it is safe to entirely remove.
- Marks <ComponentName>ClassName string exports deprecated. - Adds <ComponentnName>ClassNames object exports. - Updates API file.
…thstar Disables the static classname object conformance tests in @fluentui/react (v8) and @fluentui/react-northstar (v0).
6f29bbf to
a06d389
Compare
|
/azp run Thank you random NavigationTimeout error... |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@spmonahan what's your follow-up/action regarding getting rid of lots of deprecation lint rules being turned off ? I got bit by it when I was migrating our packages today to stop using export star #22099 |
#22132 is my proposal to get rid of the deprecations. Of course removing these is a breaking change which I propose we collect in #22130 as part of moving from RC to Stable.
The part that bit you was having to disable eslint rules for the deprecations? |
Current Behavior
No conformance tests exists for the new static class names object described in #21206.
This PR adds conformance tests and updates all existing components to pass these new tests.
New Behavior
This commit adds conformance tests for static class names. The tests:
The rules for static classnames are defined in RFC: Conventions for
static class names on slots (#21206).
I know this is quite a large PR and I'm sorry for dropping it but I feel that the changes are largely the same across all the files with the main changes being the addition of new conformance tests.
Related Issue(s)
#21847
#21206