Skip to content

Commit

Permalink
test(Card): add missing tests for ImageGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
kreafox committed Oct 17, 2023
1 parent bacc0a8 commit 5971e01
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/ui/Card/Card.stories.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CarouselCards,
FluidGrid,
CardGrid,
ImageGrid,
Default,
} from './Card.stories';

Expand Down Expand Up @@ -199,6 +200,36 @@ describe('CardGrid component', () => {
});
});

describe('ImageGrid component', () => {
it('renders correctly', () => {
const { container } = render(<ImageGrid {...ImageGrid.args} />);

expect(container.querySelector('.ui.image')).toBeInTheDocument();

expect(
container.querySelector(`.ui.card.u-card.${ImageGrid.args.variant}`),
).toBeInTheDocument();
expect(
container.querySelector(
`.ui.card.u-card.has--object-fit--${ImageGrid.args.objectFit}`,
),
).toBeInTheDocument();
expect(
container.querySelector(
`.ui.card.u-card.has--object-position--${ImageGrid.args.objectPosition}`,
),
).toBeInTheDocument();
});

it('renders the image grid with correct number of cards', () => {
const { container } = render(<ImageGrid {...ImageGrid.args} />);
const imageGridCards = container.querySelectorAll(
'.ui.card.u-card.default .ui.image',
);
expect(imageGridCards.length).toBe(5);
});
});

describe('Default component', () => {
it('renders correctly', () => {
const { container } = render(<Default {...Default.args} />);
Expand Down

0 comments on commit 5971e01

Please sign in to comment.