-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(AvatarStack): move files to folder, add e2e tests and stories (
#2907) * refactor(AvatarStack): move files to folder and add stories * Add generated e2e tests * Adjust data and source in docs * Update generated/components.json * test(vrt): update snapshots * Update generated/components.json --------- Co-authored-by: josepmartins <josepmartins@users.noreply.github.com>
- Loading branch information
1 parent
a4a12bd
commit ffa557c
Showing
47 changed files
with
254 additions
and
63 deletions.
There are no files selected for viewing
Binary file added
BIN
+6.95 KB
.../AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.92 KB
...ents/AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
...atarStack.test.ts-snapshots/AvatarStack-Align-Left-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
.../components/AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
.../AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...tarStack.test.ts-snapshots/AvatarStack-Align-Left-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...components/AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Align-Left-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.96 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Align-Right-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.94 KB
...nts/AvatarStack.test.ts-snapshots/AvatarStack-Align-Right-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.94 KB
...tarStack.test.ts-snapshots/AvatarStack-Align-Right-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.96 KB
...components/AvatarStack.test.ts-snapshots/AvatarStack-Align-Right-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.96 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Align-Right-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.79 KB
...vatarStack.test.ts-snapshots/AvatarStack-Align-Right-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.78 KB
...arStack.test.ts-snapshots/AvatarStack-Align-Right-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.78 KB
...omponents/AvatarStack.test.ts-snapshots/AvatarStack-Align-Right-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.78 KB
...vatarStack.test.ts-snapshots/AvatarStack-Align-Right-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
...nts/AvatarStack.test.ts-snapshots/AvatarStack-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.92 KB
...ponents/AvatarStack.test.ts-snapshots/AvatarStack-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
.../AvatarStack.test.ts-snapshots/AvatarStack-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
...ots/components/AvatarStack.test.ts-snapshots/AvatarStack-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.95 KB
...nts/AvatarStack.test.ts-snapshots/AvatarStack-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...ts/AvatarStack.test.ts-snapshots/AvatarStack-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...ts/components/AvatarStack.test.ts-snapshots/AvatarStack-Default-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...ts/AvatarStack.test.ts-snapshots/AvatarStack-Default-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.95 KB
.../AvatarStack.test.ts-snapshots/AvatarStack-Playground-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.92 KB
...ents/AvatarStack.test.ts-snapshots/AvatarStack-Playground-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.95 KB
...atarStack.test.ts-snapshots/AvatarStack-Playground-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.95 KB
.../components/AvatarStack.test.ts-snapshots/AvatarStack-Playground-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.95 KB
.../AvatarStack.test.ts-snapshots/AvatarStack-Playground-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Playground-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...tarStack.test.ts-snapshots/AvatarStack-Playground-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...components/AvatarStack.test.ts-snapshots/AvatarStack-Playground-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.81 KB
...AvatarStack.test.ts-snapshots/AvatarStack-Playground-light-tritanopia-linux.png
Oops, something went wrong.
This file contains 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
This file contains 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,141 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('AvatarStack', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`AvatarStack.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Playground', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`AvatarStack.Playground.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Align Left', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack-features--align-left', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`AvatarStack.Align Left.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack-features--align-left', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Align Right', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack-features--align-right', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`AvatarStack.Align Right.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-avatarstack-features--align-right', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
This file contains 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
This file contains 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
File renamed without changes.
This file contains 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,27 @@ | ||
import React from 'react' | ||
import {ComponentMeta} from '@storybook/react' | ||
import AvatarStack from './AvatarStack' | ||
import Avatar from '../Avatar' | ||
|
||
export default { | ||
title: 'Components/AvatarStack/Features', | ||
component: AvatarStack, | ||
} as ComponentMeta<typeof AvatarStack> | ||
|
||
export const AlignLeft = () => ( | ||
<AvatarStack> | ||
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" /> | ||
<Avatar alt="GitHub logo" src="https://avatars.githubusercontent.com/github" /> | ||
<Avatar alt="Atom logo" src="https://avatars.githubusercontent.com/atom" /> | ||
<Avatar alt="GitHub Desktop logo" src="https://avatars.githubusercontent.com/desktop" /> | ||
</AvatarStack> | ||
) | ||
|
||
export const AlignRight = () => ( | ||
<AvatarStack alignRight> | ||
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" /> | ||
<Avatar alt="GitHub logo" src="https://avatars.githubusercontent.com/github" /> | ||
<Avatar alt="Atom logo" src="https://avatars.githubusercontent.com/atom" /> | ||
<Avatar alt="GitHub Desktop logo" src="https://avatars.githubusercontent.com/desktop" /> | ||
</AvatarStack> | ||
) |
This file contains 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,36 @@ | ||
import React from 'react' | ||
import {ComponentMeta, ComponentStory} from '@storybook/react' | ||
import AvatarStack from './AvatarStack' | ||
import Avatar from '../Avatar' | ||
|
||
export default { | ||
title: 'Components/AvatarStack', | ||
component: AvatarStack, | ||
} as ComponentMeta<typeof AvatarStack> | ||
|
||
export const Default = () => ( | ||
<AvatarStack> | ||
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" /> | ||
<Avatar alt="GitHub logo" src="https://avatars.githubusercontent.com/github" /> | ||
<Avatar alt="Atom logo" src="https://avatars.githubusercontent.com/atom" /> | ||
<Avatar alt="GitHub Desktop logo" src="https://avatars.githubusercontent.com/desktop" /> | ||
</AvatarStack> | ||
) | ||
|
||
export const Playground: ComponentStory<typeof Avatar> = args => ( | ||
<AvatarStack {...args}> | ||
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" /> | ||
<Avatar alt="GitHub logo" src="https://avatars.githubusercontent.com/github" /> | ||
<Avatar alt="Atom logo" src="https://avatars.githubusercontent.com/atom" /> | ||
<Avatar alt="GitHub Desktop logo" src="https://avatars.githubusercontent.com/desktop" /> | ||
</AvatarStack> | ||
) | ||
|
||
Playground.argTypes = { | ||
sx: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
} |
This file contains 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
This file contains 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 @@ | ||
export {default, AvatarStackProps} from './AvatarStack' |
This file contains 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
This file was deleted.
Oops, something went wrong.