Skip to content

Commit e8fe86f

Browse files
committed
Added tests for card description.
1 parent 3c8460f commit e8fe86f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { render, screen } from '@testing-library/react';
2+
import { CardDescription } from '../CardDescription';
3+
4+
describe('CardDescription', () => {
5+
test('renders with PatternFly Core styles', () => {
6+
const { asFragment } = render(<CardDescription>text</CardDescription>);
7+
expect(asFragment()).toMatchSnapshot();
8+
});
9+
10+
test('className is added to the root element', () => {
11+
render(<CardDescription className="extra-class">text</CardDescription>);
12+
expect(screen.getByText('text')).toHaveClass('extra-class');
13+
});
14+
15+
test('extra props are spread to the root element', () => {
16+
const testId = 'card-description';
17+
18+
render(<CardDescription data-testid={testId} />);
19+
expect(screen.getByTestId(testId)).toBeInTheDocument();
20+
});
21+
});

0 commit comments

Comments
 (0)