Skip to content

Commit

Permalink
add keys for rootstory
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Dec 1, 2023
1 parent 2c8572f commit f6fc6e3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 19 deletions.
19 changes: 15 additions & 4 deletions components/Alert/react/Alert.rootstory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default () => {
title="Spec not found"
detailsTitle="Stack trace"
data-cy="alert-1"
key="alert-1"
details={
<pre className="bg-white rounded border border-red-500 px-[16px] py-[8px] overflow-x-auto">
{dedent`Uncaught Error: Error occurred in defineConfig()
Expand Down Expand Up @@ -68,6 +69,7 @@ export default () => {
</button>
{displayTimedAlert ? (
<Alert
key="alert-2"
title="Wait 5 seconds please"
duration={5000}
onDismiss={() => setDisplayTimedAlert(false)}
Expand All @@ -76,16 +78,18 @@ export default () => {
/>
) : null}
<Alert
key="alert-3"
variant="success"
dismissible
title="Success with body"
data-cy="alert-3"
>
Success body
</Alert>
<Alert variant="warning" title="Warning" notRounded />
<Alert variant="neutral" title="Neutral" />
<Alert key="alert-4" variant="warning" title="Warning" notRounded />
<Alert key="alert-5" variant="neutral" title="Neutral" />
<Alert
key="alert-6"
variant="error"
dismissible
data-cy="alert-4"
Expand All @@ -98,17 +102,24 @@ export default () => {
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum."
/>
<Alert variant="info" title="Info" />
<Alert variant="info" title="Info" customIcon={IconArrowRight} />
<Alert key="alert-7" variant="info" title="Info" />
<Alert
key="alert-8"
variant="info"
title="Info"
customIcon={IconArrowRight}
/>
{(['xs', 'sm', 'md', 'lg'] as const).map((size) => (
<>
<Alert
key="alert-9"
variant="error"
title={`${size} - Lorem ipsum dolor sit amet`}
data-cy="alert-size"
size={size}
/>
<Alert
key="alert-10"
title="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
Expand Down
5 changes: 3 additions & 2 deletions components/Button/react/Button.rootstory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ export default ({
{(Object.keys(VariantClassesTable) as ButtonVariants[]).map((variant) => {
return (
<div
key={variant}
className={clsx(
'flex flex-col items-center gap-3 justify-center mt-4 p-2',
{ 'bg-gray-1000 text-white': variant === 'outline-dark' }
{ 'bg-gray-1000 text-white': variant === 'outline-dark' },
)}
>
<h3 className="text-right">{variant}</h3>
{(Object.keys(SizeClassesTable) as ButtonSizes[])
.reverse()
.map((size) => {
return (
<div className="flex items-center justify-center">
<div key={size} className="flex items-center justify-center">
<span
className={clsx('text-sm mr-4', {
'text-gray-300': variant === 'outline-dark',
Expand Down
38 changes: 29 additions & 9 deletions components/StatusIcon/react/StatusIconReact.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ describe('StatusIcon', () => {
it('defaults to a variant that exists if the one provided does not exist', () => {
mount(
<div>
<StatusIcon variant="simple" size="16" status="placeholder" />
<StatusIcon variant="solid" size="16" status="placeholder" />
</div>
<StatusIcon
key="simple"
variant="simple"
size="16"
status="placeholder"
/>
<StatusIcon
key="solid"
variant="solid"
size="16"
status="placeholder"
/>
</div>,
)

cy.get('svg').first().invoke('html').as('firstIcon')
Expand All @@ -24,9 +34,14 @@ describe('StatusIcon', () => {
it('displays a placeholder icon if no status is passed', () => {
mount(
<div>
<StatusIcon variant="simple" size="16" />
<StatusIcon variant="solid" size="16" status="placeholder" />
</div>
<StatusIcon key="simple" variant="simple" size="16" />
<StatusIcon
key="solid"
variant="solid"
size="16"
status="placeholder"
/>
</div>,
)

cy.get('svg').first().invoke('html').as('firstIcon')
Expand All @@ -39,9 +54,14 @@ describe('StatusIcon', () => {
it('displays a placeholder icon if null status is passed', () => {
mount(
<div>
<StatusIcon variant="simple" size="16" status={null} />
<StatusIcon variant="simple" size="16" status="placeholder" />
</div>
<StatusIcon key="simple-1" variant="simple" size="16" status={null} />
<StatusIcon
key="simple-2"
variant="simple"
size="16"
status="placeholder"
/>
</div>,
)

cy.get('svg').first().invoke('html').as('firstIcon')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react'
import { mount } from 'cypress/react18'
import Tag from './Tag'
import { SizeClasses, ColorClasses } from '../constants'
import { SizeClasses, ColorClasses } from '@cypress-design/constants-tag'
import assertions from '../assertions'

describe('Tag', () => {
Expand All @@ -20,12 +20,18 @@ describe('Tag', () => {
).map((color) => {
return (
<>
<div className="flex items-center justify-center">
<div
key={color}
className="flex items-center justify-center"
>
<Tag size={size} color={color}>
{`{Tag}`}
</Tag>
</div>
<div className="flex items-center justify-center">
<div
key={`${color}-2`}
className="flex items-center justify-center"
>
<Tag size={size} color={color} dark>
{`{Tag}`}
</Tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { mount } from 'cypress/vue'
import assertions from '../assertions'
import Tag from './Tag.vue'
import { SizeClasses, ColorClasses } from '../constants'
import { SizeClasses, ColorClasses } from '../constants/dist/dist'

Check failure on line 5 in components/Tag/vue/TagVue.cy.tsx

View workflow job for this annotation

GitHub Actions / cypress-run

Cannot find module '../constants/dist/dist' or its corresponding type declarations.

describe('<Tag/>', () => {
function mountStory() {
Expand Down

0 comments on commit f6fc6e3

Please sign in to comment.