Skip to content

Commit

Permalink
chore(): status comp - add date-test attr (#5244)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmainguytalend authored Mar 27, 2024
1 parent 3a6a15e commit 1488e8a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-dolls-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@talend/design-system": patch
---

Status : add data-test\* attributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable import/no-extraneous-dependencies */
import { describe, expect, it } from '@jest/globals';
import { render, screen } from '@testing-library/react';

import Status from './StatusPrimitive';

describe('Status', () => {
it('Should render', async () => {
render(
<Status data-testid="my-status-component" variant="successful">
This is my status
</Status>,
);

expect(screen.getByTestId('my-status-component')).toBeInTheDocument();
expect(screen.getByText('This is my status')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';

import classnames from 'classnames';

// eslint-disable-next-line @talend/import-depth
import { IconNameWithSize } from '@talend/icons/dist/typeUtils';

import { Tooltip, TooltipChildrenFnProps, TooltipChildrenFnRef } from '../../Tooltip';
import { Loading } from '../../Loading';
import { mergeRefs } from '../../../mergeRef';
import { DataAttributes } from '../../../types';
import { SizedIcon } from '../../Icon';
import { Loading } from '../../Loading';
import { StackHorizontal } from '../../Stack';
import { Tooltip, TooltipChildrenFnProps, TooltipChildrenFnRef } from '../../Tooltip';

import styles from './Status.module.scss';
import { mergeRefs } from '../../../mergeRef';

export const variants = {
successful: 'successful',
Expand All @@ -26,7 +29,7 @@ export type StatusProps = {
hideText?: boolean;
children?: string;
variant: keyof typeof variants;
};
} & DataAttributes;

const Status = forwardRef(
(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';
import { useTranslation } from 'react-i18next';

import StatusPrimitive, { StatusProps } from '../Primitive/StatusPrimitive';

export type StatusCanceledProps = Omit<StatusProps, 'icon' | 'variant' | 'inProgress'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';
import { useTranslation } from 'react-i18next';

import StatusPrimitive, { StatusProps } from '../Primitive/StatusPrimitive';

export type StatusFailedProps = Omit<StatusProps, 'icon' | 'variant' | 'inProgress'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';
import { useTranslation } from 'react-i18next';

import StatusPrimitive, { StatusProps } from '../Primitive/StatusPrimitive';

export type StatusInProgressProps = Omit<StatusProps, 'icon' | 'variant' | 'inProgress'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';
import { useTranslation } from 'react-i18next';

import StatusPrimitive, { StatusProps } from '../Primitive/StatusPrimitive';

export type StatusSuccessfulProps = Omit<StatusProps, 'icon' | 'variant' | 'inProgress'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { forwardRef } from 'react';
import type { Ref } from 'react';
import { useTranslation } from 'react-i18next';

import StatusPrimitive, { StatusProps } from '../Primitive/StatusPrimitive';

export type StatusWarningProps = Omit<StatusProps, 'icon' | 'variant' | 'inProgress'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
StatusFailed,
Status,
StatusCanceled,
StatusFailed,
StatusInProgress,
StatusSuccessful,
StatusWarning,
Status,
} from '../../';
import { variants } from '../../components/Status/Primitive/StatusPrimitive';

Expand Down

0 comments on commit 1488e8a

Please sign in to comment.