diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png new file mode 100644 index 00000000000..37c22f9b6eb Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png new file mode 100644 index 00000000000..00f46281bf4 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-high-contrast-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-high-contrast-linux.png new file mode 100644 index 00000000000..e7e1e1dc3c2 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-linux.png new file mode 100644 index 00000000000..37c22f9b6eb Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png new file mode 100644 index 00000000000..37c22f9b6eb Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png new file mode 100644 index 00000000000..c72be797098 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png new file mode 100644 index 00000000000..616a524b0a2 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-linux.png new file mode 100644 index 00000000000..c72be797098 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-linux.png differ diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png new file mode 100644 index 00000000000..c72be797098 Binary files /dev/null and b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png differ diff --git a/e2e/components/BaseStyles.test.ts b/e2e/components/BaseStyles.test.ts new file mode 100644 index 00000000000..22735f58ea5 --- /dev/null +++ b/e2e/components/BaseStyles.test.ts @@ -0,0 +1,44 @@ +import {test, expect} from '@playwright/test' +import {visit} from '../test-helpers/storybook' +import {themes} from '../test-helpers/themes' + +const stories = [ + { + id: 'behaviors-basestyles-dev--default', + title: 'Dev Default', + }, +] as const + +test.describe('BaseStyles', () => { + 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( + `BaseStyles.${story.title}.${theme}.png`, + ) + }) + + test('axe @aat', async ({page}) => { + await visit(page, { + id: story.id, + globals: { + colorScheme: theme, + }, + }) + await expect(page).toHaveNoViolations() + }) + }) + } + }) + } +}) diff --git a/packages/react/src/BaseStyles.dev.stories.tsx b/packages/react/src/BaseStyles.dev.stories.tsx new file mode 100644 index 00000000000..d313f089009 --- /dev/null +++ b/packages/react/src/BaseStyles.dev.stories.tsx @@ -0,0 +1,11 @@ +import {BaseStyles} from '.' +import type {Meta} from '@storybook/react' +import React from 'react' +import type {ComponentProps} from './utils/types' + +export default { + title: 'Behaviors/BaseStyles/Dev', + component: BaseStyles, +} as Meta> + +export const Default = () => Hello diff --git a/packages/react/src/__tests__/BaseStyles.test.tsx b/packages/react/src/__tests__/BaseStyles.test.tsx new file mode 100644 index 00000000000..e7608955463 --- /dev/null +++ b/packages/react/src/__tests__/BaseStyles.test.tsx @@ -0,0 +1,33 @@ +import {render} from '@testing-library/react' +import MatchMediaMock from 'jest-matchmedia-mock' +import 'jest-styled-components' +import React from 'react' +import {BaseStyles} from '..' + +let matchMedia: MatchMediaMock + +describe('BaseStyles', () => { + beforeAll(() => { + matchMedia = new MatchMediaMock() + }) + + afterEach(() => { + matchMedia.clear() + }) + + it('has default styles', () => { + const {container} = render() + expect(container).toMatchSnapshot() + }) + + it('respects styling props', () => { + const styles = { + color: '#f00', + fontFamily: 'Arial', + lineHeight: '3.5', + } + + const {container} = render() + expect(container.children[0]).toHaveStyle({color: '#f00', 'font-family': 'Arial', 'line-height': '3.5'}) + }) +}) diff --git a/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap b/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap new file mode 100644 index 00000000000..18c719e6bff --- /dev/null +++ b/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`BaseStyles has default styles 1`] = ` +.c0 { + font-family: normal; + line-height: default; + color: fg.default; +} + +
+
+
+`;