UNPKG

648 BJavaScriptView Raw
1import React from 'react';
2import { render, cleanup } from '@testing-library/react';
3import FeedbackButton from '../src/FeedbackButton';
4
5afterEach(cleanup);
6
7describe('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});