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

chore(react-infobutton): Adding vr tests for InfoButton and updating conformance tests #25682

Closed
wants to merge 10 commits into from

Conversation

sopranopillow
Copy link
Contributor

This PR adds the following:

  • VR tests for InfoButton.
  • Updating content of InfoButton in its conformance tests.

Related Issue(s)

Fixes #25620

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 15, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
62.951 kB
17.675 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
190.427 kB
53.087 kB
react-components
react-components: FluentProvider & webLightTheme
33.456 kB
11.029 kB
react-infobutton
InfoButton
117.938 kB
35.399 kB
react-portal-compat
PortalCompatProvider
5.857 kB
1.978 kB
🤖 This report was generated against c7a1e243f8366456cb12af369ae5b749aabaec95

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 15, 2022

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 0fefe44:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Nov 15, 2022

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-Pickers 279.337 kB 279.607 kB ExceedsBaseline     270 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: c7a1e243f8366456cb12af369ae5b749aabaec95 (build)

@sopranopillow sopranopillow mentioned this pull request Nov 15, 2022
30 tasks

const infoButtonContent = 'This is the content of an InfoButton.';

storiesOf('InfoButton', module)
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to add tests for the hover, pressed, and keyboard focused states. (As a rough guideline, VR tests should cover all of the states in useInfoButtonStyles.)

Also, it should crop to a test wrapper if possible, to reduce the size of the image.

Suggested change
storiesOf('InfoButton', module)
storiesOf('InfoButton', module)
.addDecorator(TestWrapperDecoratorFixedWidth)
.addDecorator(story => (
<Screener
steps={new Steps()
.snapshot('rest', { cropTo: '.testWrapper' })
.hover('button')
.snapshot('hover', { cropTo: '.testWrapper' })
.focus('button')
.snapshot('focus', { cropTo: '.testWrapper' })
.mouseDown('button')
.snapshot('active', { cropTo: '.testWrapper' })
.end()}
>
{story()}
</Screener>
))

Copy link
Contributor

Choose a reason for hiding this comment

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

You might need to split out the size stories into a separate call to storiesOf, so that the state tests only have a single InfoButton in them.

id="show-content-small"
size="small"
content={{ children: infoButtonContent }}
popover={{ open: true } as PopoverProps}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to fix whatever is making it so you need this as PopoverProps cast. Ideally it should not be necessary here. This can be fixed in a separate PR though, since it's not related to this change.

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 16, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1581 1570 5000
Button mount 1161 1125 5000
FluentProvider mount 1946 1952 5000
FluentProviderWithTheme mount 763 784 10
FluentProviderWithTheme virtual-rerender 716 695 10
FluentProviderWithTheme virtual-rerender-with-unmount 746 754 10
MakeStyles mount 2251 2294 50000
SpinButton mount 3018 3112 5000

.addStory(
'size-open',
() => (
<div style={{ display: 'flex', flexDirection: 'column', padding: '60px', gap: '80px', alignItems: 'start' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this padding is causing the balloon to go off the edge of the TestWrapper. Maybe change it only to top padding?

image

Suggested change
<div style={{ display: 'flex', flexDirection: 'column', padding: '60px', gap: '80px', alignItems: 'start' }}>
<div style={{ display: 'flex', flexDirection: 'column', paddingTop: '60px', gap: '80px', alignItems: 'start' }}>

</Screener>
))
.addStory(
'size',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'size',
'default',

Comment on lines +43 to +56
.addStory(
'size',
() => (
<div style={{ display: 'flex', flexDirection: 'column', padding: '60px', gap: '80px', alignItems: 'start' }}>
<InfoButton size="small" content="This is the content of an InfoButton." />
<InfoButton size="medium" content="This is the content of an InfoButton." />
<InfoButton size="large" content="This is the content of an InfoButton." />
</div>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably get away with only size-open, since the rest of the visuals are tested by the default case.

Suggested change
.addStory(
'size',
() => (
<div style={{ display: 'flex', flexDirection: 'column', padding: '60px', gap: '80px', alignItems: 'start' }}>
<InfoButton size="small" content="This is the content of an InfoButton." />
<InfoButton size="medium" content="This is the content of an InfoButton." />
<InfoButton size="large" content="This is the content of an InfoButton." />
</div>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)

},
);

storiesOf('InfoButton - sizes', module)
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep this name the same so they're grouped together:

Suggested change
storiesOf('InfoButton - sizes', module)
storiesOf('InfoButton', module)

storiesOf('InfoButton - sizes', module)
.addDecorator(TestWrapperDecoratorFixedWidth)
.addDecorator(story => (
<Screener steps={new Screener.Steps().snapshot('active', { cropTo: '.testWrapper' }).end()}>{story()}</Screener>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Screener steps={new Screener.Steps().snapshot('active', { cropTo: '.testWrapper' }).end()}>{story()}</Screener>
<Screener steps={new Screener.Steps().snapshot('rest', { cropTo: '.testWrapper' }).end()}>{story()}</Screener>

Comment on lines +16 to +17
.focus('#info-button')
.snapshot('focus', { cropTo: '.testWrapper' })
Copy link
Contributor

Choose a reason for hiding this comment

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

It should have a border when focused, right? It's not showing a border in the screener results:
image

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.

InfoButton: Write tests
3 participants