From 739a40a0748865b946b16d413acc84697c71d648 Mon Sep 17 00:00:00 2001 From: guidari Date: Wed, 4 Sep 2024 12:29:32 -0300 Subject: [PATCH] fix: changes test --- packages/react/src/components/Tag/Tag-test.js | 12 ++++++++++++ packages/react/src/components/Tag/Tag.Skeleton.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/Tag/Tag-test.js b/packages/react/src/components/Tag/Tag-test.js index 0424fd687a07..fe97cbe371c1 100644 --- a/packages/react/src/components/Tag/Tag-test.js +++ b/packages/react/src/components/Tag/Tag-test.js @@ -11,6 +11,9 @@ import React from 'react'; import Tag from './'; import DismissibleTag from './DismissibleTag'; import { AILabel } from '../AILabel'; +import TagSkeleton from './Tag.Skeleton'; + +const prefix = 'cds'; describe('Tag', () => { describe('automated accessibility testing', () => { @@ -63,4 +66,13 @@ describe('Tag', () => { screen.getByRole('button', { name: 'AI - Show information' }) ).toBeInTheDocument(); }); + + it('should render a skeleton state', () => { + const { container } = render(); + + // eslint-disable-next-line testing-library/no-container, testing-library/no-node-access + const selectWrapper = container.querySelector(`.${prefix}--tag`); + + expect(selectWrapper).toHaveClass(`${prefix}--skeleton`); + }); }); diff --git a/packages/react/src/components/Tag/Tag.Skeleton.tsx b/packages/react/src/components/Tag/Tag.Skeleton.tsx index a9e2819351af..1ec256648fb1 100644 --- a/packages/react/src/components/Tag/Tag.Skeleton.tsx +++ b/packages/react/src/components/Tag/Tag.Skeleton.tsx @@ -31,7 +31,7 @@ function TagSkeleton({ className, size, ...rest }: TagSkeletonProps) { `${prefix}--skeleton`, className, { - [`${prefix}--tag--${size}`]: size, // TODO: V12 - Remove this class + [`${prefix}--tag--${size}`]: size, // TODO: V12 - Remove this class a [`${prefix}--layout--size-${size}`]: size, } );