-
Notifications
You must be signed in to change notification settings - Fork 564
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c242f85
ui mob pair
langermank d7baa6c
Create clever-birds-press.md
langermank a7f84c8
Merge branch 'main' into heading-component-style-props
langermank 1b09d49
test(vrt): update snapshots
langermank 5c41033
fix
langermank d1a7194
reset
langermank ff9427c
test(vrt): update snapshots
langermank 37d3334
try to only test light
langermank 2fc9a62
Merge branch 'heading-component-style-props' of https://github.com/pr…
langermank 9f1f5ad
reset
langermank cd6cd1b
test(vrt): update snapshots
langermank d20ebef
fix test
langermank 812346c
test(vrt): update snapshots
langermank c9d6ce3
lint
langermank 248610a
Merge branch 'heading-component-style-props' of https://github.com/pr…
langermank ec81987
Update packages/react/src/Heading/Heading.docs.json
langermank b5344e1
fix typo
langermank 90dca8e
Merge branch 'main' into heading-component-style-props
langermank 9f3e23b
lint
langermank 0c7bf0a
fix story name
langermank 3dfaeaa
reset
langermank 772d7cb
fix test name
langermank e4ad72f
Merge branch 'main' into heading-component-style-props
joshblack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Add `variant` prop to Heading for small, medium and large styles |
Binary file added
BIN
+10.7 KB
...wright/snapshots/components/Heading.test.ts-snapshots/Heading-Default-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
+9.58 KB
.playwright/snapshots/components/Heading.test.ts-snapshots/Heading-Large-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.06 KB
...ywright/snapshots/components/Heading.test.ts-snapshots/Heading-Medium-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
+7.29 KB
.playwright/snapshots/components/Heading.test.ts-snapshots/Heading-Small-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
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-features--small', | ||
}) | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Small.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading-features--small', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
|
||
test.describe('Medium', () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading-features--medium', | ||
}) | ||
|
||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Medium.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading-features--medium', | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
|
||
test.describe('Large', () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading-features--large', | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`Heading.Large.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-heading-features--large', | ||
}) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import type {StoryFn} from '@storybook/react' | ||
import Heading from './Heading' | ||
|
||
export default { | ||
title: 'Components/Heading/Features', | ||
} | ||
|
||
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> |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.