Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
Add variant prop to Heading#4806
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c242f85d7baa6ca7f84c81b09d495c41033d1a7194ff9427c37d33342fc9a629f1f5adcd6cd1bd20ebef812346cc9d6ce3248610aec81987b5344e190dca8e9f3e23b0c7bf0a3dfaeaa772d7cbe4ad72fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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 | ||
| 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`) | ||
Member 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? ContributorAuthor 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() | ||
| }) | ||
| }) | ||
| }) | ||
| 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> |
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.