-
Notifications
You must be signed in to change notification settings - Fork 2.9k
chore(text): Add screenshot tests #28932
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
Merged
miroslavstastny
merged 1 commit into
microsoft:web-components-v3
from
miroslavstastny:chore/vr-text
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
apps/vr-tests-web-components/src/stories/text/text.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| import * as React from 'react'; | ||
| import { default as parse } from 'html-react-parser'; | ||
| import { Steps, StoryWright } from 'storywright'; | ||
| import { TextDefinition, FluentDesignSystem, colorNeutralBackground6 } from '@fluentui/web-components'; | ||
|
|
||
| TextDefinition.define(FluentDesignSystem.registry); | ||
|
|
||
| export default { | ||
| title: 'Text', | ||
| decorators: [ | ||
| (story: () => React.ReactElement) => { | ||
| return ( | ||
| <StoryWright steps={new Steps().snapshot('normal', { cropTo: '.testWrapper' }).end()}> | ||
| <div className="testWrapper" style={{ width: '322px' }}> | ||
| {story()} | ||
| </div> | ||
| </StoryWright> | ||
| ); | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export const Default = () => | ||
| parse(` | ||
| <fluent-text><span>Default</span></fluent-text> | ||
| `); | ||
|
|
||
| export const Nowrap = () => | ||
| parse(` | ||
| <fluent-text nowrap> | ||
| <div style="display: block; width: 320px; border: 1px solid black;"> | ||
| This text will not wrap lines when it overflows the container. | ||
| </div> | ||
| </fluent-text> | ||
| `); | ||
|
|
||
| export const Truncate = () => | ||
| parse(` | ||
| <fluent-text truncate nowrap> | ||
| <div style="display: block; width: 320px; border: 1px solid black;"> | ||
| Setting <code>truncate</code> and <code>nowrap</code> will truncate when it overflows the container. | ||
| </div> | ||
| </fluent-text> | ||
| `); | ||
|
|
||
| export const Italic = () => | ||
| parse(` | ||
| <fluent-text italic> | ||
| <span>Italics are emphasized text.</span> | ||
| </fluent-text> | ||
| `); | ||
|
|
||
| export const Underline = () => | ||
| parse(` | ||
| <fluent-text underline> | ||
| <span>Underlined text draws the reader's attention to the words.</span> | ||
| </fluent-text> | ||
| `); | ||
|
|
||
| export const Strikethrough = () => | ||
| parse(` | ||
| <fluent-text strikethrough> | ||
| <span>Strikethrough text is used to indicate something that is no longer relevant.</span> | ||
| </fluent-text> | ||
| `); | ||
|
|
||
| export const Block = () => | ||
| parse(` | ||
| <span> | ||
| <fluent-text style="background: ${colorNeutralBackground6}" | ||
| ><span>Fluent text is inline by default. Setting</span></fluent-text | ||
| > | ||
| <fluent-text style="background: ${colorNeutralBackground6}" block><span>block</span></fluent-text> | ||
| <fluent-text style="background: ${colorNeutralBackground6}" | ||
| ><span>will make it behave as a block element.</span></fluent-text | ||
| > | ||
| </span> | ||
| `); | ||
|
|
||
| export const Size = () => | ||
| parse(` | ||
| <div> | ||
| <fluent-text block size="100"><span>100</span></fluent-text> | ||
| <fluent-text block size="200"><span>200</span></fluent-text> | ||
| <fluent-text block size="300"><span>300</span></fluent-text> | ||
| <fluent-text block size="400"><span>400</span></fluent-text> | ||
| <fluent-text block size="500"><span>500</span></fluent-text> | ||
| <fluent-text block size="600"><span>600</span></fluent-text> | ||
| <fluent-text block size="700"><span>700</span></fluent-text> | ||
| <fluent-text block size="800"><span>800</span></fluent-text> | ||
| <fluent-text block size="900"><span>900</span></fluent-text> | ||
| <fluent-text block size="1000"><span>1000</span></fluent-text> | ||
| </div> | ||
| `); | ||
|
|
||
| export const Weight = () => | ||
| parse(` | ||
| <div> | ||
| <fluent-text block weight="regular"><span>This text is regular.</span></fluent-text> | ||
| <fluent-text block weight="medium"><span>This text is medium.</span></fluent-text> | ||
| <fluent-text block weight="semibold"><span>This text is semibold.</span></fluent-text> | ||
| <fluent-text block weight="bold"><span>This text is bold.</span></fluent-text> | ||
| </div> | ||
| `); | ||
|
|
||
| export const Align = () => | ||
| parse(` | ||
| <div | ||
| style="display: flex; flex-direction: column; gap: 20px; width: 320px; border-left: 1px solid #000; border-right: 1px solid #000;" | ||
| > | ||
| <fluent-text block align="start"> | ||
| <span>Start aligned block.</span> | ||
| </fluent-text> | ||
| <fluent-text block align="end"> | ||
| <span>End aligned block.</span> | ||
| </fluent-text> | ||
| <fluent-text block align="center"> | ||
| <span>Center aligned block.</span> | ||
| </fluent-text> | ||
| <fluent-text block align="justify"> | ||
| <span>Justify aligned block text stretches wrapped lines to meet container edges.</span> | ||
| </fluent-text> | ||
| </div> | ||
| `); | ||
|
|
||
| export const Font = () => | ||
| parse(` | ||
| <div> | ||
| <fluent-text block font="base"><span>Font base.</span></fluent-text> | ||
| <fluent-text block font="numeric"><span>Font numeric 0123456789.</span></fluent-text> | ||
| <fluent-text block font="monospace"><span>Font monospace.</span></fluent-text> | ||
| </div> | ||
| `); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🕵 fluentui-web-components-v3 Open the Visual Regressions report to inspect the affected screenshots
Text 11 screenshots
TextInput 3 screenshots