Skip to content

Commit

Permalink
Added tests to Tag Skeleton (#17460)
Browse files Browse the repository at this point in the history
* chore(release): v11.66.0 (#17413)

Co-authored-by: tay1orjones <[email protected]>
Co-authored-by: Taylor Jones <[email protected]>

* test: added test to skeleton

* test: removed tests for tag

* test: removed function

* test: added test for size prop

* fix: changed const name

---------

Co-authored-by: carbon-automation[bot] <103539138+carbon-automation[bot]@users.noreply.github.com>
Co-authored-by: tay1orjones <[email protected]>
Co-authored-by: Taylor Jones <[email protected]>
Co-authored-by: Gururaj J <[email protected]>
  • Loading branch information
5 people authored Sep 19, 2024
1 parent 494e28c commit fab91fa
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/react/src/components/Tag/Tag-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import { Add } from '@carbon/icons-react';
import { render, screen } from '@testing-library/react';
import React from 'react';
import Tag from './';
import Tag, { TagSkeleton } from './';
import DismissibleTag from './DismissibleTag';
import { AILabel } from '../AILabel';

const prefix = 'cds';

describe('Tag', () => {
describe('automated accessibility testing', () => {
it('should have no Axe violations', async () => {
Expand Down Expand Up @@ -63,4 +65,22 @@ describe('Tag', () => {
screen.getByRole('button', { name: 'AI - Show information' })
).toBeInTheDocument();
});

describe('Skeleton Tag', () => {
it('should render a skeleton state', () => {
const { container } = render(<TagSkeleton />);

const skeletonTag = container.querySelector(`.${prefix}--tag`);

expect(skeletonTag).toHaveClass(`${prefix}--skeleton`);
});

it('should render a skeleton state with a small size', () => {
const { container } = render(<TagSkeleton size="sm" />);

const skeletonTag = container.querySelector(`.${prefix}--tag`);

expect(skeletonTag).toHaveClass(`${prefix}--layout--size-sm`);
});
});
});

0 comments on commit fab91fa

Please sign in to comment.