-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add variant
prop to Heading
#4806
Changes from 15 commits
c242f85
d7baa6c
a7f84c8
1b09d49
5c41033
d1a7194
ff9427c
37d3334
2fc9a62
9f1f5ad
cd6cd1b
d20ebef
812346c
c9d6ce3
248610a
ec81987
b5344e1
90dca8e
9f3e23b
0c7bf0a
3dfaeaa
772d7cb
e4ad72f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Add `variant` prop to Heading for small, medium and large styles |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange that these tests show up on this PR? Are these changes from a different PR committed here? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,74 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('Heading', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--default', | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Default.png`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aww? we don't tests for all themes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its just testing for font-size so color doesn't matter 😄 |
||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--default', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
|
||
test.describe('Small', () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--small', | ||
}) | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Small.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--small', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
|
||
test.describe('Medium', () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--medium', | ||
}) | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Medium.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--medium', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
|
||
test.describe('Large', () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--large', | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Large.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading--large', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in file name, would mess with automated examples in docs - Heading.featires.stories.tsx
+ Heading.features.stories.tsx There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tire 😄 thanks! |
||
import type {StoryFn} from '@storybook/react' | ||
import Heading from './Heading' | ||
|
||
export default { | ||
title: 'Components/Heading', | ||
} | ||
|
||
export const TestSx: StoryFn<typeof Heading> = () => ( | ||
<Heading | ||
sx={{ | ||
fontSize: 2, | ||
fontWeight: 'normal', | ||
}} | ||
> | ||
Heading with sx override | ||
</Heading> | ||
) | ||
|
||
export const Small: StoryFn<typeof Heading> = () => <Heading variant="small">Small heading</Heading> | ||
|
||
export const Medium: StoryFn<typeof Heading> = () => <Heading variant="medium">Medium heading</Heading> | ||
|
||
export const Large: StoryFn<typeof Heading> = () => <Heading variant="large">Large heading</Heading> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.