Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/babel/cli-7.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Mar 13, 2023
2 parents 1bcdb66 + 418f316 commit e595508
Show file tree
Hide file tree
Showing 73 changed files with 348 additions and 167 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
title: Dialog v2
componentId: dialog
componentId: dialog_2
status: Draft
a11yReviewed: false
description: Use an underlined nav to allow tab like navigation with overflow behaviour in your UI.
source: https://github.com/primer/react/tree/main/src/Dialog2
storybook: '/react/storybook/?path=/story/drafts-components-dialog--default'
---

import data from '../../../src/Dialog/Dialog.docs.json'
import data from '../../../src/Dialog2/Dialog.docs.json'

```js
import {Dialog} from '@primer/react/drafts'
Expand Down
2 changes: 1 addition & 1 deletion docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
- title: Drafts
children:
- title: Dialog v2
url: /drafts/Dialog
url: /drafts/Dialog2
- title: InlineAutocomplete
url: /drafts/InlineAutocomplete
- title: MarkdownEditor
Expand Down
131 changes: 131 additions & 0 deletions e2e/components/DialogV2.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

test.describe('DialogV2', () => {
test.describe('Default', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog--default',
globals: {
colorScheme: theme,
},
})

// Default state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Default.${theme}.png`)
// Open Dialog
await page.getByRole('button', {name: 'Show dialog'}).click()
// wait for dialog to open
await page.getByRole('dialog', {name: 'Dialog'}).waitFor()
// Open state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Default.${theme}.open.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog--default',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('Basic Dialog', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog-features--basic-dialog',
globals: {
colorScheme: theme,
},
})

// Default state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Basic Dialog.${theme}.png`)
// Open Dialog
await page.getByRole('button', {name: 'Show dialog'}).click()
// wait for dialog to open
await page.getByRole('dialog', {name: 'Dialog'}).waitFor()
// Open state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Basic Dialog.${theme}.open.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog-features--basic-dialog',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('Basic Confirmation Dialog', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog-features--basic-confirmation-dialog',
globals: {
colorScheme: theme,
},
})

// Default state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Basic Confirmation Dialog.${theme}.png`)
// Open Dialog
await page.getByRole('button', {name: 'Show dialog'}).click()
// wait for dialog to open
await page.getByRole('alertdialog').waitFor()
// Open state
expect(
await page.screenshot({
animations: 'disabled',
}),
).toMatchSnapshot(`DialogV2.Basic Confirmation Dialog.${theme}.open.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-dialog-features--basic-confirmation-dialog',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})
})
7 changes: 6 additions & 1 deletion generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,12 @@
"name": "Dialog",
"status": "draft",
"a11yReviewed": false,
"stories": [],
"stories": [
{
"id": "components-dialog--default",
"code": "() => {\n const [isOpen, setIsOpen] = useState(false)\n const buttonRef = useRef<HTMLButtonElement>(null)\n const onDialogClose = useCallback(() => setIsOpen(false), [])\n return (\n <>\n <Button ref={buttonRef} onClick={() => setIsOpen(!isOpen)}>\n Show dialog\n </Button>\n {isOpen && <Dialog onClose={onDialogClose}>Dialog Content</Dialog>}\n </>\n )\n}"
}
],
"props": [
{
"name": "title",
Expand Down
19 changes: 19 additions & 0 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,25 @@ const components = new Map([
],
},
],
[
'DialogV2',
{
stories: [
{
id: 'drafts-components-dialog--default',
name: 'Default',
},
{
id: 'drafts-components-dialog-features--basic-dialog',
name: 'Basic Dialog',
},
{
id: 'drafts-components-dialog-features--basic-confirmation-dialog',
name: 'Basic Confirmation Dialog',
},
],
},
],
[
'Flash',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Box from '../Box'
import {ThemeProvider, useTheme, ThemeProviderProps} from '../ThemeProvider'
import {FocusKeys} from '@primer/behaviors'
import {get} from '../constants'
import {Dialog, DialogProps, DialogHeaderProps, DialogButtonProps} from '../Dialog/Dialog'
import {Dialog, DialogProps, DialogHeaderProps, DialogButtonProps} from './Dialog'
import {useFocusZone} from '../hooks/useFocusZone'

/**
Expand Down
File renamed without changes.
Loading

0 comments on commit e595508

Please sign in to comment.