-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,081 additions
and
188 deletions.
There are no files selected for viewing
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,7 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Adds UnderlinePanels component. It's like UnderlineNav, but for rendering semantic tabs instead of links. | ||
|
||
<!-- Changed components: UnderilnePanels --> |
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,245 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('UnderlinePanels', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Labelled By External Element', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--labelled-by-external-element', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.Labelled By External Element.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--labelled-by-external-element', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Selected Tab', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--selected-tab', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.Selected Tab.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--selected-tab', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('With Counters', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-counters', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Counters.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-counters', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('With Counters In Loading State', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-counters-in-loading-state', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Counters In Loading State.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-counters-in-loading-state', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('With Icons', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-icons', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Icons.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-icons', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('With Icons Hidden On Narrow Screen', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-icons-hidden-on-narrow-screen', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot( | ||
`UnderlineNav.With Icons Hidden On Narrow Screen.${theme}.png`, | ||
) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'drafts-components-underlinepanels-features--with-icons-hidden-on-narrow-screen', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations({ | ||
rules: { | ||
'color-contrast': { | ||
enabled: theme !== 'dark_dimmed', | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
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
Oops, something went wrong.