-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(CircleBadge): move files into folder, add e2e tests. (#3118)
* Reorganize CircleBadge, add e2e tests. * Update generated/components.json * test(vrt): update snapshots * Update docs reference. --------- Co-authored-by: radglob <radglob@users.noreply.github.com>
- Loading branch information
Showing
26 changed files
with
191 additions
and
62 deletions.
There are no files selected for viewing
Binary file added
BIN
+8.7 KB
...nts/CircleBadge.test.ts-snapshots/CircleBadge-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
+8.8 KB
...ponents/CircleBadge.test.ts-snapshots/CircleBadge-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
+8.33 KB
.../CircleBadge.test.ts-snapshots/CircleBadge-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
+8.7 KB
...ots/components/CircleBadge.test.ts-snapshots/CircleBadge-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
+8.7 KB
...nts/CircleBadge.test.ts-snapshots/CircleBadge-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
+8.56 KB
...ts/CircleBadge.test.ts-snapshots/CircleBadge-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
+8.47 KB
...CircleBadge.test.ts-snapshots/CircleBadge-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
+8.55 KB
...ts/components/CircleBadge.test.ts-snapshots/CircleBadge-Default-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
+8.56 KB
...ts/CircleBadge.test.ts-snapshots/CircleBadge-Default-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
+8.7 KB
.../CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.8 KB
...ents/CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.33 KB
...rcleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.7 KB
.../components/CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.7 KB
.../CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.56 KB
...CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.47 KB
...cleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.55 KB
...components/CircleBadge.test.ts-snapshots/CircleBadge-Playground-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
+8.56 KB
...CircleBadge.test.ts-snapshots/CircleBadge-Playground-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.
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,61 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('CircleBadge', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-circlebadge--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`CircleBadge.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-circlebadge--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Playground', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-circlebadge--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`CircleBadge.Playground.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-circlebadge--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
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,47 @@ | ||
import React from 'react' | ||
import {Meta, ComponentStory} from '@storybook/react' | ||
import CircleBadge from './CircleBadge' | ||
import {ZapIcon} from '@primer/octicons-react' | ||
|
||
export default { | ||
title: 'Components/CircleBadge', | ||
component: CircleBadge, | ||
} as Meta<typeof CircleBadge> | ||
|
||
export const Default = () => ( | ||
<CircleBadge> | ||
<CircleBadge.Icon icon={ZapIcon} /> | ||
</CircleBadge> | ||
) | ||
|
||
export const Playground: ComponentStory<typeof CircleBadge> = args => ( | ||
<CircleBadge {...args}> | ||
<CircleBadge.Icon icon={ZapIcon} /> | ||
</CircleBadge> | ||
) | ||
|
||
Playground.args = { | ||
variant: 'medium', | ||
size: null, | ||
inline: false, | ||
as: 'div', | ||
} | ||
|
||
Playground.argTypes = { | ||
variant: { | ||
control: { | ||
type: 'radio', | ||
}, | ||
options: ['small', 'medium', 'large'], | ||
}, | ||
size: { | ||
control: { | ||
type: 'number', | ||
}, | ||
}, | ||
inline: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
} |
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, CircleBadgeProps, CircleBadgeIconProps} from './CircleBadge' |