1 | import React from 'react';
|
2 | import { render, cleanup } from '@testing-library/react';
|
3 | import FeedbackButton from '../src/FeedbackButton';
|
4 |
|
5 | afterEach(cleanup);
|
6 |
|
7 | describe('Feedback', () => {
|
8 | test('should render an icon', () => {
|
9 | const { getByTestId } = render(<FeedbackButton icon="home" />);
|
10 |
|
11 | // eslint-disable-next-line unicorn/prefer-query-selector
|
12 | expect(getByTestId('feedback-icon').className).toContain('icon-home');
|
13 | });
|
14 |
|
15 | test('should highlight when active', () => {
|
16 | const { container } = render(<FeedbackButton icon="home" active="home" />);
|
17 |
|
18 | expect(container.firstChild.className).toContain('btn-primary');
|
19 | });
|
20 | });
|