Skip to content

Commit

Permalink
test(component): Update unit tests for Cards
Browse files Browse the repository at this point in the history
- [x] with `href=".."`, should render an `<a>`

- [x] should use `href` classes
  • Loading branch information
tulup-conner committed Jun 6, 2022
1 parent e0a5da2 commit ae65160
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/lib/components/Card/Card.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ describe.concurrent('Components / Card', () => {
expect(card).toBeInTheDocument();
});

describe('`href=".."`', () => {
it('should render an `<a>`', () => {
const card = getCard(render(<Card href="#" />));

expect(card).toBeInTheDocument();
expect(card.tagName.toLocaleLowerCase()).toEqual('a');
});
});

describe('`horizontal={true}`', () => {
it('should render', () => {
const card = getCard(render(<Card horizontal />));
Expand Down Expand Up @@ -117,6 +126,24 @@ describe.concurrent('Components / Card', () => {
expect(horizontalCard).toHaveClass('text-blue-300');
});

it('should use `href` classes', () => {
const theme = {
card: {
href: 'text-blue-700',
},
};

const card = getCard(
render(
<Flowbite theme={{ theme }}>
<Card href="#">My card</Card>
</Flowbite>,
),
);

expect(card).toHaveClass('text-blue-700');
});

it('should use `img` classes', () => {
const theme = {
card: {
Expand Down

0 comments on commit ae65160

Please sign in to comment.