Skip to content

Commit

Permalink
Merge branch 'main' into francinelucca/3423-prcbuttongroup-group-cont…
Browse files Browse the repository at this point in the history
…ainer-lacks-a-role--does-not-convey-its-purpose
  • Loading branch information
francinelucca authored Nov 4, 2024
2 parents b51c79a + 26b54d8 commit fb53032
Show file tree
Hide file tree
Showing 314 changed files with 3,109 additions and 1,173 deletions.
5 changes: 0 additions & 5 deletions .changeset/clean-mails-accept.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fifty-suns-smoke.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/gold-items-shave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/grumpy-lamps-behave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hungry-avocados-remember.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/itchy-paws-bake.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/loud-spoons-explode.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/lovely-shirts-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

TreeView: Adds indication of no nodes in a tree item, allows for `aria-expanded even if the item is empty.
5 changes: 0 additions & 5 deletions .changeset/odd-frogs-listen.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/old-plums-explode.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/shiny-chefs-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Update `SubNav` component to use CSS modules behind the feature flag primer_react_css_modules_team
5 changes: 0 additions & 5 deletions .changeset/shy-seahorses-mix.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/six-colts-admire.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/slow-snails-swim.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/sour-flies-camp.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/spotty-rice-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Allow primitives dep to be if version 9 OR 10
5 changes: 0 additions & 5 deletions .changeset/twelve-kings-confess.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wild-maps-grow.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wise-llamas-exist.md

This file was deleted.

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.
59 changes: 56 additions & 3 deletions contributor-docs/migrating-to-css-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This guide outlines the steps to follow when refactoring Primer React components

- **Verify VRT (Visual Regression Testing) Coverage:**
- Check for missing VRT coverage. We utilize the VRT tests to make sure we're matching styling in production with current expectations. Components should have a Storybook story for every "feature" or option available that impacts the UI for VRT to capture in a screenshot.
- Make sure there are `dev` stories for any edge cases spotted in production for the component (ie. `sx` prop, custom className, styled system attributes). `dev` stories may include things that we wouldn't normally recommend for the purpose of stress testing what happens when PRC components are overridden with custom styles.
- **Ensure All Visual Changes Are Completed:**
- Make necessary visual changes **before** creating the CSS Modules refactor PR.

Expand Down Expand Up @@ -121,11 +120,65 @@ This guide outlines the steps to follow when refactoring Primer React components
expect(render(<FeatureFlagElement />).container.firstChild).toHaveClass('test-class-name')
})
```
- **Regression Testing:**
- Validate that no visual regressions occur when the feature flag is enabled. The `vrt*` tests are setup to compare the feature flagged component with the original component and will fail if there is a mismatch.
- **Handling `sx` Prop:**
- Confirm the `sx` prop behaves correctly with the feature flag enabled.

#### Visual regression testing

Validate that no visual regressions occur when the feature flag is enabled. The `vrt*` tests are setup to compare the feature flagged component with the original component and will fail if there is a mismatch.

- Add `dev` stories for any edge cases spotted in production for the component (ie. `sx` prop, custom className, styled system attributes). `dev` stories may include things that we wouldn't normally recommend for the purpose of stress testing what happens when PRC components are overridden with custom styles.
- Setup VRT tests for `dev` stories. Copy an existing test in the corresponding test file in the [e2e directory](https://github.com/primer/react/tree/main/e2e/components) and update the id to match the new `dev` story.

Example test file:

```ts
import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

const stories = [
{
title: 'Dev: Test color',
id: 'components-{componentname}-dev--customcolor',
},
] as const

test.describe('ComponentName', () => {
for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ComponentName.${story.title}.${theme}.png`,
)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})
}
})
```

---

## Releasing a Component
Expand Down
142 changes: 45 additions & 97 deletions e2e/components/BranchName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,110 +2,58 @@ import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

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

// Default state
expect(await page.screenshot()).toMatchSnapshot(`BranchName.Default.${theme}.png`)

// Focus state
await page.keyboard.press('Tab')
expect(await page.screenshot()).toMatchSnapshot(`BranchName.Default.${theme}.focus.png`)
})
const stories = [
{
title: 'Default',
id: 'components-branchname--default',
focus: true,
},
{
title: 'Not A Link',
id: 'components-branchname-features--not-a-link',
focus: false,
},
{
title: 'With A Branch Icon',
id: 'components-branchname-features--with-branch-icon',
focus: false,
},
] as const

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-branchname--default',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
test.describe('BranchName', () => {
for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
},
})
})
})
}
})

test.describe('Not A Link', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-branchname-features--not-a-link',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`BranchName.Not A Link.${theme}.png`)
})
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-branchname-features--not-a-link',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
},
},
})
})
})
}
})
// Default state
expect(await page.screenshot()).toMatchSnapshot(`BranchName.${story.title}.${theme}.png`)

test.describe('With A Branch Icon', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-branchname-features--with-branch-icon',
globals: {
colorScheme: theme,
},
// Focus state
if (story.focus) {
await page.keyboard.press('Tab')
expect(await page.screenshot()).toMatchSnapshot(`BranchName.${story.title}.${theme}.focus.png`)
}
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`BranchName.With A Branch Icon.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-branchname-features--with-branch-icon',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
test('axe @aat', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
},
})
await expect(page).toHaveNoViolations()
})
})
})
}
})
}
})
}
})
Loading

0 comments on commit fb53032

Please sign in to comment.