-
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
Add tests for hover states #24390
Add tests for hover states #24390
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 cc08b01:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 9e86978c43db785ec3f40ee9e0bd35693e26189d (build) |
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
Avatar | mount | 1300 | 1312 | 5000 | |
Button | mount | 952 | 958 | 5000 | |
FluentProvider | mount | 1593 | 1593 | 5000 | |
FluentProviderWithTheme | mount | 641 | 637 | 10 | |
FluentProviderWithTheme | virtual-rerender | 591 | 602 | 10 | |
FluentProviderWithTheme | virtual-rerender-with-unmount | 626 | 643 | 10 | |
MakeStyles | mount | 1903 | 1932 | 50000 | |
SpinButton | mount | 2529 | 2543 | 5000 |
Perf Analysis (
|
Scenario | Current PR Ticks | Baseline Ticks | Ratio |
---|---|---|---|
ButtonMinimalPerf.default | 177 | 151 | 1.17:1 |
FormMinimalPerf.default | 422 | 378 | 1.12:1 |
TreeWith60ListItems.default | 173 | 155 | 1.12:1 |
FlexMinimalPerf.default | 312 | 284 | 1.1:1 |
PortalMinimalPerf.default | 180 | 163 | 1.1:1 |
ToolbarMinimalPerf.default | 961 | 886 | 1.08:1 |
IconMinimalPerf.default | 683 | 637 | 1.07:1 |
DropdownManyItemsPerf.default | 714 | 675 | 1.06:1 |
ImageMinimalPerf.default | 383 | 360 | 1.06:1 |
ListWith60ListItems.default | 649 | 610 | 1.06:1 |
ChatDuplicateMessagesPerf.default | 309 | 293 | 1.05:1 |
SegmentMinimalPerf.default | 353 | 337 | 1.05:1 |
LayoutMinimalPerf.default | 361 | 346 | 1.04:1 |
ListMinimalPerf.default | 517 | 496 | 1.04:1 |
RefMinimalPerf.default | 216 | 207 | 1.04:1 |
SkeletonMinimalPerf.default | 353 | 338 | 1.04:1 |
SliderMinimalPerf.default | 1716 | 1655 | 1.04:1 |
TextAreaMinimalPerf.default | 468 | 449 | 1.04:1 |
AnimationMinimalPerf.default | 554 | 538 | 1.03:1 |
ButtonSlotsPerf.default | 545 | 531 | 1.03:1 |
DropdownMinimalPerf.default | 3278 | 3194 | 1.03:1 |
HeaderSlotsPerf.default | 760 | 736 | 1.03:1 |
SplitButtonMinimalPerf.default | 4497 | 4374 | 1.03:1 |
DividerMinimalPerf.default | 368 | 361 | 1.02:1 |
MenuMinimalPerf.default | 855 | 841 | 1.02:1 |
PopupMinimalPerf.default | 651 | 640 | 1.02:1 |
TableManyItemsPerf.default | 1979 | 1944 | 1.02:1 |
TreeMinimalPerf.default | 842 | 826 | 1.02:1 |
AlertMinimalPerf.default | 288 | 284 | 1.01:1 |
AttachmentMinimalPerf.default | 145 | 144 | 1.01:1 |
ButtonOverridesMissPerf.default | 1510 | 1493 | 1.01:1 |
DatepickerMinimalPerf.default | 5964 | 5927 | 1.01:1 |
EmbedMinimalPerf.default | 4185 | 4149 | 1.01:1 |
InputMinimalPerf.default | 1318 | 1308 | 1.01:1 |
ListCommonPerf.default | 637 | 629 | 1.01:1 |
ListNestedPerf.default | 551 | 544 | 1.01:1 |
RadioGroupMinimalPerf.default | 456 | 450 | 1.01:1 |
LabelMinimalPerf.default | 391 | 392 | 1:1 |
MenuButtonMinimalPerf.default | 1724 | 1721 | 1:1 |
StatusMinimalPerf.default | 668 | 671 | 1:1 |
VideoMinimalPerf.default | 720 | 722 | 1:1 |
AttachmentSlotsPerf.default | 1117 | 1133 | 0.99:1 |
AvatarMinimalPerf.default | 194 | 196 | 0.99:1 |
ChatWithPopoverPerf.default | 386 | 390 | 0.99:1 |
DialogMinimalPerf.default | 763 | 768 | 0.99:1 |
ItemLayoutMinimalPerf.default | 1212 | 1227 | 0.99:1 |
ProviderMergeThemesPerf.default | 1290 | 1303 | 0.99:1 |
ProviderMinimalPerf.default | 397 | 399 | 0.99:1 |
TextMinimalPerf.default | 342 | 346 | 0.99:1 |
CustomToolbarPrototype.default | 2927 | 2949 | 0.99:1 |
ChatMinimalPerf.default | 731 | 745 | 0.98:1 |
CheckboxMinimalPerf.default | 2707 | 2761 | 0.98:1 |
HeaderMinimalPerf.default | 351 | 359 | 0.98:1 |
TableMinimalPerf.default | 396 | 403 | 0.98:1 |
AccordionMinimalPerf.default | 144 | 149 | 0.97:1 |
BoxMinimalPerf.default | 323 | 332 | 0.97:1 |
CardMinimalPerf.default | 543 | 557 | 0.97:1 |
CarouselMinimalPerf.default | 466 | 482 | 0.97:1 |
GridMinimalPerf.default | 324 | 333 | 0.97:1 |
LoaderMinimalPerf.default | 696 | 720 | 0.97:1 |
RosterPerf.default | 2091 | 2160 | 0.97:1 |
TooltipMinimalPerf.default | 2340 | 2477 | 0.94:1 |
ReactionMinimalPerf.default | 357 | 390 | 0.92:1 |
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
BaseButton | mount | 749 | 783 | 5000 | |
Breadcrumb | mount | 2426 | 2422 | 1000 | |
Checkbox | mount | 2200 | 2211 | 5000 | |
CheckboxBase | mount | 1955 | 1908 | 5000 | |
ChoiceGroup | mount | 3955 | 3950 | 5000 | |
ComboBox | mount | 829 | 861 | 1000 | |
CommandBar | mount | 9084 | 9057 | 1000 | |
ContextualMenu | mount | 10550 | 10464 | 1000 | |
DefaultButton | mount | 955 | 971 | 5000 | |
DetailsRow | mount | 3222 | 3242 | 5000 | |
DetailsRowFast | mount | 3245 | 3180 | 5000 | |
DetailsRowNoStyles | mount | 3104 | 3090 | 5000 | |
Dialog | mount | 2604 | 2696 | 1000 | |
DocumentCardTitle | mount | 153 | 146 | 1000 | |
Dropdown | mount | 2817 | 2825 | 5000 | |
FocusTrapZone | mount | 1600 | 1567 | 5000 | |
FocusZone | mount | 1535 | 1573 | 5000 | |
IconButton | mount | 1478 | 1481 | 5000 | |
Label | mount | 302 | 324 | 5000 | |
Layer | mount | 3871 | 3825 | 5000 | |
Link | mount | 412 | 404 | 5000 | |
MenuButton | mount | 1238 | 1231 | 5000 | |
MessageBar | mount | 1807 | 1835 | 5000 | |
Nav | mount | 2842 | 2817 | 1000 | |
OverflowSet | mount | 941 | 939 | 5000 | |
Panel | mount | 2133 | 2079 | 1000 | |
Persona | mount | 837 | 858 | 1000 | |
Pivot | mount | 1203 | 1225 | 1000 | |
PrimaryButton | mount | 1098 | 1109 | 5000 | |
Rating | mount | 6542 | 6650 | 5000 | |
SearchBox | mount | 1088 | 1075 | 5000 | |
Shimmer | mount | 2467 | 2436 | 5000 | |
Slider | mount | 1649 | 1646 | 5000 | |
SpinButton | mount | 4580 | 4252 | 5000 | |
Spinner | mount | 383 | 381 | 5000 | |
SplitButton | mount | 2662 | 2690 | 5000 | |
Stack | mount | 435 | 436 | 5000 | |
StackWithIntrinsicChildren | mount | 1979 | 1980 | 5000 | |
StackWithTextChildren | mount | 4398 | 4353 | 5000 | |
SwatchColorPicker | mount | 10107 | 10150 | 5000 | |
TagPicker | mount | 2218 | 2235 | 5000 | |
TeachingBubble | mount | 85285 | 84665 | 5000 | |
Text | mount | 360 | 360 | 5000 | |
TextField | mount | 1180 | 1186 | 5000 | |
ThemeProvider | mount | 1093 | 1098 | 5000 | |
ThemeProvider | virtual-rerender | 642 | 651 | 5000 | |
ThemeProvider | virtual-rerender-with-unmount | 1738 | 1722 | 5000 | |
Toggle | mount | 688 | 694 | 5000 | |
buttonNative | mount | 112 | 126 | 5000 |
if (points.length === index) { | ||
return; | ||
} | ||
singleStackedData.forEach((singlePoint: IDPointType, pointIndex: number) => { |
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.
Is there a better way than looping through all points here
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.
Other charts dont use isShowCalloutPending state at all. Let me see if there is a better way.
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 went through the code again but I am not able to find any better solution because of circleId
@@ -487,25 +487,29 @@ export class CartesianChartBase extends React.Component<IModifiedCartesianChartP | |||
// If there is no legend, need not to allocate some space from total chart space. | |||
legendContainerHeight = 0; | |||
} else { | |||
const legendContainerComputedStyles = getComputedStyle(this.legendContainer); | |||
const legendContainerComputedStyles = this.legendContainer && getComputedStyle(this.legendContainer); |
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.
why is this change needed
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.
|
||
it('Should render callout on hover', () => { | ||
wrapper = mount(<GroupedVerticalBarChart data={chartPoints} calloutProps={{ doNotLayer: true }} />); | ||
wrapper.find('rect').at(0).simulate('mouseover'); |
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.
are you able to simulate mouseover at different x, y coordinates as well
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 can simulate mouseover on different rect but not at different x, y coordinates as they depend on the viewport
<VerticalBarChart data={chartPoints} calloutProps={{ doNotLayer: true }} enabledLegendsWrapLines />, | ||
); | ||
|
||
// Wait for the chart to be resized |
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.
why is this wait needed
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.
Without wait, the bars are not rendered because the barHeight stays 0
wrapper = mount(<AreaChart data={chartPoints} calloutProps={{ doNotLayer: true }} />, { attachTo: root }); | ||
wrapper.find('rect').simulate('mouseover'); | ||
const tree = toJson(wrapper, { mode: 'deep' }); | ||
expect(tree).toMatchSnapshot(); |
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.
Also test callout for stack and custom callouts
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.
Try moving the mouse hover and observe the callout changing positions and values.
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.
Okay
{ attachTo: root }, | ||
); | ||
wrapper.find('rect').simulate('mouseover'); | ||
expect(wrapper.exists('.custom-callout')).toBe(true); |
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.
can you match snapshot here
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.
Yes, I can. But the callout will only render a div without props, so should I match snapshot just to check that?
wrapper.find('path[id^="_Pie_"]').at(0).simulate('mouseleave'); | ||
wrapper.find('path[id^="_Pie_"]').at(1).simulate('mousemove'); | ||
const textContent2 = wrapper.find('.ms-Callout').hostNodes().text(); | ||
expect(textContent1).not.toBe(textContent2); |
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.
Add a comment on what is the expected text
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.
Okay
); | ||
await new Promise(resolve => setTimeout(resolve)); | ||
wrapper.update(); | ||
wrapper.find('rect').at(2).simulate('mousemove'); |
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.
what does 2 and 3 represent
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.
There are multiple rect in the chart, so .at(2) and .at(3) selects the 3rd and 4th rect respectively
b858e1d
to
09cbca0
Compare
09cbca0
to
131d65b
Compare
packages/react-charting/package.json
Outdated
@@ -31,7 +31,8 @@ | |||
"@fluentui/react": "^8.91.1", | |||
"@types/react-addons-test-utils": "0.14.18", | |||
"@fluentui/scripts": "^1.0.0", | |||
"@fluentui/jest-serializer-merge-styles": "^8.0.20" | |||
"@fluentui/jest-serializer-merge-styles": "^8.0.20", | |||
"enzyme-to-json": "3.6.2" |
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.
can you please move this to root package.json
devDependency ? we are in the process to adhere to single version policy approach for devDependencies, thus this violates that. ty
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.
done
a15380c
to
cc08b01
Compare
* master: (28 commits) Fix value font-weight inside heatmap chart (microsoft#24726) Fix legend overflow-indication-text role (microsoft#24756) Support custom locale in date axis (microsoft#24753) Cleanup env variables (microsoft#24739) ci(github): add GH Action to add issue labels based on new GH issue template (microsoft#24788) Update disallowedChangeTypes for newly created packages, to allow only 'prerelease' change types by default (microsoft#24763) feat(react-components): Adding missing AvatarGroup exports (microsoft#24770) remove unnecessary nohoist (microsoft#24760) feat(react-dialog): supports 1st rule of ARIA (microsoft#24525) BREAKING: TableCell layouts are handled by layout components (microsoft#24762) feat: Implement table cell layout components (microsoft#24773) applying package updates fix: remove readonly from DetailsList (microsoft#24615) chore: Cleaning up tokens in Button components so they better adhere to the design spec (microsoft#24732) fix: react-combobox listbox popup width matches trigger width (microsoft#24733) fix: react-combobox Option focus outline only shows with keyboard nav (microsoft#24700) feat: Publish react-field package, and export from react-components/unstable (microsoft#24235) fix: Replacing bottom border styles with text decoration underline in Link (microsoft#24734) docs(react-theme): Update readme (microsoft#24755) Add tests for hover states (microsoft#24390) ...
Current Behavior
Tests for hover states do not exist
New Behavior
Tests if hovering over the charts renders a callout correctly