Skip to content
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

chore: add data-test attr on stacks #5192

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/four-islands-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/design-system': minor
---

chore: add data-test attr on stacks
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { expect } from '@jest/globals';
import { render, screen } from '@testing-library/react';

import StackPrimitive from './StackPrimitive';

describe('StackPrimitive', () => {
it('Should render with data-test attributes', async () => {
render(
<StackPrimitive
data-test="my-stack"
data-testid="my-stack-testid"
data-feature="my-stack-feature"
gap={0}
>
text
</StackPrimitive>,
);

const stack = screen.getByTestId('my-stack-testid');
expect(stack).toBeInTheDocument();

expect(stack).toHaveAttribute('data-test', 'my-stack');
expect(stack).toHaveAttribute('data-feature', 'my-stack-feature');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { ReactNode, Ref } from 'react';

import classnames from 'classnames';

import { DataAttributes } from '../../../types';

import styles from './StackPrimitive.module.scss';

export const justifyOptions = {
Expand Down Expand Up @@ -112,7 +114,7 @@ export type StackPrimitiveProps = {
isFullWidth?: boolean;
noShrink?: boolean;
noGrow?: boolean;
};
} & DataAttributes;

const StackPrimitive = forwardRef(function StackPrimitive(
{
Expand Down
Loading