Skip to content
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

feat(Icons): update icon svg factory example & added components tests #12675

Merged
merged 12 commits into from Apr 16, 2020

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Apr 14, 2020

This PR is continuing the work from #12608

Things done in this PR:

  • added example showing all icons
  • added conformant test for the icon components

image

-added components tests
@size-auditor
Copy link

size-auditor bot commented Apr 14, 2020

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 49c040e8963a9b242083a782b531ec35845fde5d (build)

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Apr 14, 2020

Perf Analysis

Scenario Master Ticks PR Ticks Iterations Status
Stack 454 429 5000 Possible regression
All results

Scenario Master Ticks PR Ticks Iterations Status
BaseButton 737 768 5000
Checkbox 1727 1725 5000
CheckboxBase 1368 1362 5000
ChoiceGroup 4925 4900 5000
ComboBox 907 913 1000
CommandBar 7347 7569 1000
DefaultButton 962 999 5000
DetailsRow 3180 3151 5000
DetailsRow (fast icons) 3240 3214 5000
DetailsRow without styles 3002 2988 5000
Dialog 1399 1413 1000
DocumentCardTitle with truncation 1613 1565 1000
Dropdown 2994 2791 5000
FocusZone 1535 1476 5000
IconButton 1549 1532 5000
Label 440 437 5000
Link 410 421 5000
MenuButton 1282 1290 5000
Nav 2933 3269 1000
Panel 1311 1309 1000
Persona 762 769 1000
Pivot 1187 1187 1000
PrimaryButton 1141 1097 5000
SearchBox 1350 1389 5000
Slider 1644 1759 5000
Spinner 364 358 5000
SplitButton 2869 2916 5000
Stack 454 429 5000 Possible regression
Stack with Intrinsic children 1047 1027 5000
Stack with Text children 3787 3726 5000
TagPicker 2707 2511 5000
Text 343 349 5000
TextField 1599 1612 5000
Toggle 793 822 5000
button 61 62 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🎯 Avatar.Fluent 0.45 0.48 0.94:1 2000 903
🦄 Button.Fluent 0.1 0.18 0.56:1 5000 504
🔧 Checkbox.Fluent 0.66 0.36 1.83:1 1000 655
🔧 Dialog.Fluent 0.33 0.19 1.74:1 5000 1643
🔧 Dropdown.Fluent 3.14 0.52 6.04:1 1000 3143
🔧 Icon.Fluent 0.13 0.05 2.6:1 5000 661
🎯 Image.Fluent 0.07 0.1 0.7:1 5000 367
🔧 Slider.Fluent 1.37 0.4 3.43:1 1000 1366
🔧 Text.Fluent 0.07 0.02 3.5:1 5000 366
🦄 Tooltip.Fluent 0.09 19.88 0:1 5000 436

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
Button.Fluent 504 448 1.13:1
AttachmentMinimalPerf.default 150 135 1.11:1
HeaderMinimalPerf.default 475 433 1.1:1
Text.Fluent 366 337 1.09:1
AttachmentSlotsPerf.default 1200 1107 1.08:1
AccordionMinimalPerf.default 199 188 1.06:1
ListWith60ListItems.default 1148 1088 1.06:1
IconMinimalPerf.default 648 614 1.06:1
ButtonMinimalPerf.default 161 154 1.05:1
EmbedMinimalPerf.default 4329 4127 1.05:1
FlexMinimalPerf.default 292 279 1.05:1
PopupMinimalPerf.default 253 242 1.05:1
CardMinimalPerf.default 401 387 1.04:1
ReactionMinimalPerf.default 1791 1722 1.04:1
TooltipMinimalPerf.default 687 659 1.04:1
Checkbox.Fluent 655 630 1.04:1
AvatarMinimalPerf.default 506 489 1.03:1
ChatDuplicateMessagesPerf.default 425 411 1.03:1
MenuMinimalPerf.default 1766 1720 1.03:1
TreeMinimalPerf.default 1148 1117 1.03:1
TreeWith60ListItems.default 215 208 1.03:1
Dialog.Fluent 1643 1597 1.03:1
AlertMinimalPerf.default 497 486 1.02:1
DropdownManyItemsPerf.default 1323 1299 1.02:1
ItemLayoutMinimalPerf.default 1601 1575 1.02:1
ListCommonPerf.default 937 915 1.02:1
TableMinimalPerf.default 541 529 1.02:1
VideoMinimalPerf.default 722 708 1.02:1
Slider.Fluent 1366 1336 1.02:1
CarouselMinimalPerf.default 554 550 1.01:1
HeaderSlotsPerf.default 1407 1390 1.01:1
ImageMinimalPerf.default 362 360 1.01:1
ListMinimalPerf.default 449 444 1.01:1
ToolbarMinimalPerf.default 957 948 1.01:1
Icon.Fluent 661 653 1.01:1
Image.Fluent 367 365 1.01:1
ButtonSlotsPerf.default 573 575 1:1
FormMinimalPerf.default 686 688 1:1
GridMinimalPerf.default 619 617 1:1
InputMinimalPerf.default 955 958 1:1
LayoutMinimalPerf.default 522 523 1:1
LoaderMinimalPerf.default 758 755 1:1
MenuButtonMinimalPerf.default 1473 1474 1:1
ProviderMinimalPerf.default 677 675 1:1
SliderMinimalPerf.default 1360 1365 1:1
SplitButtonMinimalPerf.default 3615 3598 1:1
StatusMinimalPerf.default 665 664 1:1
CustomToolbarPrototype.default 3620 3619 1:1
Dropdown.Fluent 3143 3133 1:1
Tooltip.Fluent 436 436 1:1
DialogMinimalPerf.default 1626 1636 0.99:1
DropdownMinimalPerf.default 3143 3180 0.99:1
LabelMinimalPerf.default 379 383 0.99:1
SegmentMinimalPerf.default 876 881 0.99:1
BoxMinimalPerf.default 339 346 0.98:1
CheckboxMinimalPerf.default 2799 2863 0.98:1
HierarchicalTreeMinimalPerf.default 938 954 0.98:1
PortalMinimalPerf.default 292 297 0.98:1
RadioGroupMinimalPerf.default 536 547 0.98:1
RefMinimalPerf.default 190 194 0.98:1
TextMinimalPerf.default 345 352 0.98:1
Avatar.Fluent 903 920 0.98:1
AnimationMinimalPerf.default 620 642 0.97:1
ChatMinimalPerf.default 593 610 0.97:1
TextAreaMinimalPerf.default 2609 2691 0.97:1
ChatWithPopoverPerf.default 567 589 0.96:1
ListNestedPerf.default 863 897 0.96:1
ProviderMergeThemesPerf.default 1541 1619 0.95:1
DividerMinimalPerf.default 663 723 0.92:1

});

const icons = Object.keys(ReactIcons).reduce((acc: React.FC[], exportName) => {
Copy link
Member

Choose a reason for hiding this comment

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

We may want to not load all 2000+ icons here but rather a few key ones, or have a separate page as an icon viewing page.

Copy link
Member

Choose a reason for hiding this comment

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

Note that this page ends up showing in both the public doc site and the snapshot tests.

Copy link
Contributor Author

@mnajdova mnajdova Apr 16, 2020

Choose a reason for hiding this comment

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

Actually I am showing 100 icons at a time, as I have pagination. I didn’t know what’s the best way of testing all icons with screenshots, so let’s sync on that.

expect(ReactIs.isValidElementType(IconComponent)).toEqual(true);
});

test(`${file} matches displayName`, () => {
Copy link
Member

Choose a reason for hiding this comment

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

May be good to add a few more conformance tests like it can take a className prop, what about passing along data- attributes, do we support as (I don't think so but can't remember.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add the data- attributes and className tests, and you are right we do not support as prop.

Copy link
Member

@dzearing dzearing left a comment

Choose a reason for hiding this comment

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

Maybe slim down how many icons we show here. This could be merged first and then that could be addressed in the other uber PR.

Would be good to make sure we have a few more test cases covered though. :)

I will approve, let's get this one merged first. I also checked in a change to publish this package, as the fabric package was depending on a private unpublished package which broke some cases. My bad for not thinking about that. But we will look at beachball to prevent these scenarios in the future.

…con.SvgFactory.Example.tsx

Co-Authored-By: David Zearing <dzearing@microsoft.com>
@mnajdova
Copy link
Contributor Author

mnajdova commented Apr 16, 2020

Maybe slim down how many icons we show here. This could be merged first and then that could be addressed in the other uber PR.

I have pagination, I show only 100 icons on page.

Would be good to make sure we have a few more test cases covered though. :)

Will add the recommended tests, but will add them in createSvgFactory.test.tsx as there are similar tests there already and we don't want to run common tests for each icon. These tests are more for conformance of naming of the exported icons.

I will approve, let's get this one merged first. I also checked in a change to publish this package, as the fabric package was depending on a private unpublished package which broke some cases. My bad for not thinking about that. But we will look at beachball to prevent these scenarios in the future.

This is scary, how this even happend? Aren't we automatically releasing the packages created? :\ Would be good if you can reference some guide for this if there is.

@msft-github-bot
Copy link
Contributor

🎉@fluentui/react-icons@v0.1.2 has been released which incorporates this pull request.:tada:

Handy links:

@msft-github-bot
Copy link
Contributor

🎉office-ui-fabric-react@v7.106.3 has been released which incorporates this pull request.:tada:

Handy links:

DuanShaolong pushed a commit to DuanShaolong/fluentui that referenced this pull request Apr 27, 2020
…microsoft#12675)

* -changed svg factory example
-added components tests

* Change files

* -fixed import

* -fixed example and updates snapshot

* -converted to mergeStyleSets

* -addressed comments

* Update packages/office-ui-fabric-react/src/components/Icon/examples/Icon.SvgFactory.Example.tsx

Co-Authored-By: David Zearing <dzearing@microsoft.com>

* -added tests

* Change files

* -description

Co-authored-by: David Zearing <dzearing@microsoft.com>
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.

None yet

5 participants