|
| 1 | +/* eslint react/no-multi-comp: 0, react/prop-types: 0 */ |
| 2 | +import React from 'react'; |
| 3 | +import { shallow } from 'enzyme'; |
| 4 | +import { BreadcrumbItem } from 'reactstrap'; |
| 5 | + |
| 6 | +describe('BreadcrumbItem', () => { |
| 7 | + it('should render children', () => { |
| 8 | + const wrapper = shallow(<BreadcrumbItem>Yo!</BreadcrumbItem>); |
| 9 | + |
| 10 | + expect(wrapper.text()).toBe('Yo!'); |
| 11 | + }); |
| 12 | + |
| 13 | + it('should render "li" by default', () => { |
| 14 | + const wrapper = shallow(<BreadcrumbItem>Yo!</BreadcrumbItem>); |
| 15 | + |
| 16 | + expect(wrapper.type()).toBe('li'); |
| 17 | + }); |
| 18 | + |
| 19 | + it('should render with the "breadcrumb-item" class', () => { |
| 20 | + const wrapper = shallow(<BreadcrumbItem>Default BreadcrumbItem</BreadcrumbItem>); |
| 21 | + |
| 22 | + expect(wrapper.hasClass('breadcrumb-item')).toBe(true); |
| 23 | + }); |
| 24 | + |
| 25 | + it('should not render with the "active" class by default', () => { |
| 26 | + const wrapper = shallow(<BreadcrumbItem>Default BreadcrumbItem</BreadcrumbItem>); |
| 27 | + |
| 28 | + expect(wrapper.hasClass('active')).toBe(false); |
| 29 | + }); |
| 30 | + |
| 31 | + it('should render with the "active" class when the avtive prop is truthy', () => { |
| 32 | + const wrapper = shallow(<BreadcrumbItem active>Default BreadcrumbItem</BreadcrumbItem>); |
| 33 | + |
| 34 | + expect(wrapper.hasClass('active')).toBe(true); |
| 35 | + }); |
| 36 | + |
| 37 | + it('should render custom tag', () => { |
| 38 | + const wrapper = shallow(<BreadcrumbItem tag="main">Yo!</BreadcrumbItem>); |
| 39 | + |
| 40 | + expect(wrapper.type()).toBe('main'); |
| 41 | + }); |
| 42 | +}); |
0 commit comments