Skip to content

Textarea stories #2988

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

Merged
merged 35 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8c34118
checkbox
langermank Mar 1, 2023
5edd2c1
Update generated/components.json
langermank Mar 1, 2023
85e7f8e
tests
langermank Mar 1, 2023
b650d32
Merge branch 'form-stories' of https://github.com/primer/react into f…
langermank Mar 1, 2023
2fc8f35
Merge branch 'main' into form-stories
langermank Mar 1, 2023
a46cea8
Update generated/components.json
langermank Mar 1, 2023
1bea816
fix docs
langermank Mar 1, 2023
b3470ad
Merge branch 'form-stories' of https://github.com/primer/react into f…
langermank Mar 1, 2023
459e43e
radio stories
langermank Mar 1, 2023
543decf
Update generated/components.json
langermank Mar 1, 2023
7b71e1c
fix doc
langermank Mar 1, 2023
3f79146
Merge branch 'radio-stories' of https://github.com/primer/react into …
langermank Mar 1, 2023
617dbc8
remove axe
langermank Mar 1, 2023
ef13f94
add sb tests
langermank Mar 1, 2023
2bb64ca
select
langermank Mar 1, 2023
2ed3a34
Merge branch 'main' of https://github.com/primer/react into select-st…
langermank Mar 2, 2023
d3d34d5
add features
langermank Mar 2, 2023
687077e
e2e
langermank Mar 2, 2023
c5022d3
text input
langermank Mar 2, 2023
d6d9e99
Update generated/components.json
langermank Mar 2, 2023
a8c60e3
tokens
langermank Mar 2, 2023
d785879
Update generated/components.json
langermank Mar 2, 2023
03e30fb
tokens
langermank Mar 2, 2023
23ec595
textarea
langermank Mar 2, 2023
b8585ee
all the things
langermank Mar 2, 2023
8752acb
Merge branch 'main' of https://github.com/primer/react into textarea
langermank Mar 6, 2023
74c2baa
Update generated/components.json
langermank Mar 6, 2023
55ba104
remove animation test
langermank Mar 6, 2023
b377443
Merge branch 'textarea' of https://github.com/primer/react into textarea
langermank Mar 6, 2023
bebc189
test(vrt): update snapshots
langermank Mar 6, 2023
053e521
remove dead files
langermank Mar 6, 2023
664c30b
Merge branch 'textarea' of https://github.com/primer/react into textarea
langermank Mar 6, 2023
573b5f4
Update generated/components.json
langermank Mar 6, 2023
318cd75
Merge branch 'main' into textarea
langermank Mar 6, 2023
36623a8
missing exports
langermank Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
2 changes: 1 addition & 1 deletion docs/content/Textarea.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source: https://github.com/primer/react/blob/main/src/Textarea.tsx
storybook: '/react/storybook?path=/story/components-forms-textarea--textarea-story'
---

import data from '../../src/Textarea.docs.json'
import data from '../../src/Textarea/Textarea.docs.json'

import {Textarea} from '@primer/react'

Expand Down
229 changes: 229 additions & 0 deletions e2e/components/Textarea.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

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

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

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

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

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

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--block',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

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

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

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--disabled',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

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

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`Textarea.Error.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--error',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

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

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`Textarea.Success.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--success',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('Visually Hidden Label', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--visually-hidden-label',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`Textarea.Visually Hidden Label.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--visually-hidden-label',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

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

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`Textarea.Warning.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--warning',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('With Caption', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--with-caption',
globals: {
colorScheme: theme,
},
})

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

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-textarea-features--with-caption',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})
})
131 changes: 68 additions & 63 deletions generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -691,69 +691,6 @@
],
"subcomponents": []
},
"textarea": {
"id": "textarea",
"name": "Textarea",
"status": "alpha",
"a11yReviewed": false,
"stories": [],
"props": [
{
"name": "required",
"type": "boolean",
"defaultValue": "",
"description": "Indicates to the user and assistive technologies that the field value is required"
},
{
"name": "cols",
"type": "number",
"defaultValue": "",
"description": "Specifies the visible width of a text area."
},
{
"name": "rows",
"type": "number",
"defaultValue": "",
"description": "Specifies the visible height of a text area."
},
{
"name": "block",
"type": "boolean",
"defaultValue": "false",
"description": "Expands with width of the component to fill the parent elements"
},
{
"name": "resize",
"type": "'both' | 'horizontal' | 'vertical' | 'none'",
"defaultValue": "'both'",
"description": "Changes background color to a higher contrast color"
},
{
"name": "validationStatus",
"type": "'success' | 'error' | undefined",
"defaultValue": "",
"description": "Style the textarea to match the current form validation status"
},
{
"name": "ref",
"type": "React.RefObject<HTMLTextAreaElement>"
},
{
"name": "ref",
"type": "React.RefObject<HTMLTextareaElement>"
},
{
"name": "as",
"type": "React.ElementType",
"defaultValue": "\"input\""
},
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": []
},
"tooltip": {
"id": "tooltip",
"name": "Tooltip",
Expand Down Expand Up @@ -4153,6 +4090,74 @@
],
"subcomponents": []
},
"textarea": {
"id": "textarea",
"name": "Textarea",
"status": "alpha",
"a11yReviewed": false,
"stories": [
{
"id": "components-textarea--default",
"code": "() => (\n <Box as=\"form\">\n <FormControl>\n <FormControl.Label>Default label</FormControl.Label>\n <Textarea />\n </FormControl>\n </Box>\n)"
}
],
"props": [
{
"name": "required",
"type": "boolean",
"defaultValue": "",
"description": "Indicates to the user and assistive technologies that the field value is required"
},
{
"name": "cols",
"type": "number",
"defaultValue": "",
"description": "Specifies the visible width of a text area."
},
{
"name": "rows",
"type": "number",
"defaultValue": "",
"description": "Specifies the visible height of a text area."
},
{
"name": "block",
"type": "boolean",
"defaultValue": "false",
"description": "Expands with width of the component to fill the parent elements"
},
{
"name": "resize",
"type": "'both' | 'horizontal' | 'vertical' | 'none'",
"defaultValue": "'both'",
"description": "Changes background color to a higher contrast color"
},
{
"name": "validationStatus",
"type": "'success' | 'error' | undefined",
"defaultValue": "",
"description": "Style the textarea to match the current form validation status"
},
{
"name": "ref",
"type": "React.RefObject<HTMLTextAreaElement>"
},
{
"name": "ref",
"type": "React.RefObject<HTMLTextareaElement>"
},
{
"name": "as",
"type": "React.ElementType",
"defaultValue": "\"input\""
},
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": []
},
"timeline": {
"id": "timeline",
"name": "Timeline",
Expand Down
Loading