UNPKG

880 BJavaScriptView Raw
1import React from 'react';
2import { render, screen } from '@testing-library/react';
3import { Breadcrumb } from '..';
4import {
5 testForChildrenInComponent,
6 testForCustomTag,
7 testForDefaultTag,
8} from '../testUtils';
9
10describe('Breadcrumb', () => {
11 it('should render children', () => {
12 testForChildrenInComponent(Breadcrumb);
13 });
14
15 it('should render "nav" by default', () => {
16 testForDefaultTag(Breadcrumb, 'nav');
17 });
18
19 it('should render "ol" by default', () => {
20 render(<Breadcrumb>Yo!</Breadcrumb>);
21 expect(screen.getByText('Yo!').tagName.toLowerCase()).toMatch('ol');
22 });
23
24 it('should render with the "breadcrumb" class', () => {
25 render(<Breadcrumb data-testid="test">Yo!</Breadcrumb>);
26 expect(screen.getByText('Yo!')).toHaveClass('breadcrumb');
27 });
28
29 it('should render custom tag', () => {
30 testForCustomTag(Breadcrumb);
31 });
32});