Skip to content

Commit

Permalink
adds test case
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSonOfThomp committed Apr 5, 2024
1 parent e2bc0f6 commit 1229b13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import { render } from '@testing-library/react';
import { ListSkeleton } from '.';

describe('packages/skeleton-list', () => {
test('condition', () => {
test('renders', () => {
const { queryByTestId } = render(<ListSkeleton />);
expect(queryByTestId('lg-skeleton-list')).toBeInTheDocument();
});

test('renders `count` items', () => {
const { queryAllByTestId } = render(<ListSkeleton count={3} />);
const listItems = queryAllByTestId('lg-skeleton-list_item');
expect(listItems.length).toBe(3);
});
});
2 changes: 1 addition & 1 deletion packages/skeleton-loader/src/ListSkeleton/ListSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export function ListSkeleton({
<li
// Update the key when `count` changes so the item animation stays in sync
key={`${i}/${count}`}
// className={skeletonListItemStyles}
className={getSkeletonListItemStyles(i, bulletsOnly)}
data-testid="lg-skeleton-list_item"
>
<Skeleton size="small" />
</li>
Expand Down

0 comments on commit 1229b13

Please sign in to comment.