UNPKG

791 BJavaScriptView Raw
1import React from 'react';
2import { render, screen } from '@testing-library/react';
3import { NavItem } from '..';
4import {
5 testForChildrenInComponent,
6 testForCustomClass,
7 testForCustomTag,
8 testForDefaultClass,
9} from '../testUtils';
10
11describe('NavItem', () => {
12 it('should render .nav-item class', () => {
13 testForDefaultClass(NavItem, 'nav-item');
14 });
15
16 it('should render custom tag', () => {
17 testForCustomTag(NavItem);
18 });
19
20 it('should render children', () => {
21 testForChildrenInComponent(NavItem);
22 });
23
24 it('should pass additional classNames', () => {
25 testForCustomClass(NavItem);
26 });
27
28 it('should render active class', () => {
29 render(<NavItem active data-testid="test" />);
30 expect(screen.getByTestId('test')).toHaveClass('active');
31 });
32});
33
\No newline at end of file