2022-03-21 11:09:01 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-04-04 08:53:47 -07:00
|
|
|
import { render, screen } from '../../../../jest/test-helpers';
|
2022-03-21 11:09:01 -07:00
|
|
|
import { Card, CardBody, CardHeader, CardTitle } from '../card';
|
|
|
|
|
|
|
|
describe('<Card />', () => {
|
|
|
|
it('renders the CardTitle and CardBody', () => {
|
2022-04-04 08:53:47 -07:00
|
|
|
render(
|
2022-03-21 11:09:01 -07:00
|
|
|
<Card>
|
|
|
|
<CardHeader>
|
|
|
|
<CardTitle title='Card Title' />
|
|
|
|
</CardHeader>
|
|
|
|
|
|
|
|
<CardBody>
|
|
|
|
Card Body
|
|
|
|
</CardBody>
|
|
|
|
</Card>,
|
|
|
|
);
|
|
|
|
|
2022-04-04 08:53:47 -07:00
|
|
|
expect(screen.getByTestId('card-title')).toHaveTextContent('Card Title');
|
|
|
|
expect(screen.getByTestId('card-body')).toHaveTextContent('Card Body');
|
|
|
|
expect(screen.queryByTestId('back-button')).not.toBeInTheDocument();
|
2022-03-21 11:09:01 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('renders the Back Button', () => {
|
2022-04-04 08:53:47 -07:00
|
|
|
render(
|
2022-03-21 11:09:01 -07:00
|
|
|
<Card>
|
|
|
|
<CardHeader backHref='/'>
|
|
|
|
<CardTitle title='Card Title' />
|
|
|
|
</CardHeader>
|
|
|
|
</Card>,
|
|
|
|
);
|
|
|
|
|
2022-04-04 08:53:47 -07:00
|
|
|
expect(screen.getByTestId('back-button')).toBeInTheDocument();
|
2022-03-21 11:09:01 -07:00
|
|
|
});
|
|
|
|
});
|