Skip to content

Commit

Permalink
Fix data attribute pattern for Card
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorado committed Dec 30, 2021
1 parent ee233d0 commit a32eb01
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
12 changes: 6 additions & 6 deletions packages/ui/src/organisms/Card/Card.test.tsx
Expand Up @@ -47,16 +47,16 @@ describe('Card', () => {
expect(card).toHaveAttribute('data-store-card')
})

it('`CardContent` component should have `data-store-card-content` attribute', () => {
expect(cardContent).toHaveAttribute('data-store-card-content')
it('`CardContent` component should have `data-card-content` attribute', () => {
expect(cardContent).toHaveAttribute('data-card-content')
})

it('`CardImage` component should have `data-store-card-image` attribute', () => {
expect(cardImage).toHaveAttribute('data-store-card-image')
it('`CardImage` component should have `data-card-image` attribute', () => {
expect(cardImage).toHaveAttribute('data-card-image')
})

it('`CardActions` component should have `data-store-card-actions` attribute', () => {
expect(cardActions).toHaveAttribute('data-store-card-actions')
it('`CardActions` component should have `data-card-actions` attribute', () => {
expect(cardActions).toHaveAttribute('data-card-actions')
})
})

Expand Down
7 changes: 1 addition & 6 deletions packages/ui/src/organisms/Card/CardActions.tsx
Expand Up @@ -14,12 +14,7 @@ const CardActions = forwardRef<HTMLDivElement, CardActionsProps>(
ref
) {
return (
<div
ref={ref}
data-store-card-actions
data-testid={testId}
{...otherProps}
>
<div ref={ref} data-card-actions data-testid={testId} {...otherProps}>
{children}
</div>
)
Expand Down
7 changes: 1 addition & 6 deletions packages/ui/src/organisms/Card/CardContent.tsx
Expand Up @@ -14,12 +14,7 @@ const CardContent = forwardRef<HTMLElement, CardContentProps>(
ref
) {
return (
<section
ref={ref}
data-store-card-content
data-testid={testId}
{...otherProps}
>
<section ref={ref} data-card-content data-testid={testId} {...otherProps}>
{children}
</section>
)
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/organisms/Card/CardImage.tsx
Expand Up @@ -13,7 +13,7 @@ const CardImage = forwardRef<HTMLDivElement, CardImageProps>(function CardImage(
ref
) {
return (
<div ref={ref} data-store-card-image data-testid={testId} {...otherProps}>
<div ref={ref} data-card-image data-testid={testId} {...otherProps}>
{children}
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/organisms/Card/stories/Card.mdx
Expand Up @@ -45,10 +45,10 @@ All Card-related components support all attributes also supported by the `<div>`
```css
[data-store-card] {
}
[data-store-card-image] {
[data-card-image] {
}
[data-store-card-content] {
[data-card-content] {
}
[data-store-card-actions] {
[data-card-actions] {
}
```

0 comments on commit a32eb01

Please sign in to comment.