1 | import React from 'react';
|
2 | import { render, screen } from '@testing-library/react';
|
3 | import '@testing-library/jest-dom';
|
4 | import { BreadcrumbItem } from '..';
|
5 | import {
|
6 | testForChildrenInComponent,
|
7 | testForCustomTag,
|
8 | testForDefaultClass,
|
9 | testForDefaultTag,
|
10 | } from '../testUtils';
|
11 |
|
12 | describe('BreadcrumbItem', () => {
|
13 | it('should render children', () => {
|
14 | testForChildrenInComponent(BreadcrumbItem);
|
15 | });
|
16 |
|
17 | it('should render "li" by default', () => {
|
18 | testForDefaultTag(BreadcrumbItem, 'li');
|
19 | });
|
20 |
|
21 | it('should render with the "breadcrumb-item" class', () => {
|
22 | testForDefaultClass(BreadcrumbItem, 'breadcrumb-item');
|
23 | });
|
24 |
|
25 | it('should not render with the "active" class by default', () => {
|
26 | render(<BreadcrumbItem>Yo!</BreadcrumbItem>);
|
27 | expect(screen.getByText('Yo!')).not.toHaveClass('active');
|
28 | });
|
29 |
|
30 | it('should render with the "active" class when the avtive prop is truthy', () => {
|
31 | render(<BreadcrumbItem active>Yo!</BreadcrumbItem>);
|
32 | expect(screen.getByText('Yo!')).toHaveClass('active');
|
33 | });
|
34 |
|
35 | it('should render custom tag', () => {
|
36 | testForCustomTag(BreadcrumbItem);
|
37 | });
|
38 | });
|