/
CardSubtitle.spec.js
33 lines (25 loc) · 1.02 KB
/
CardSubtitle.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import { shallow } from 'enzyme';
import { CardSubtitle } from '../';
describe('CardSubtitle', () => {
it('should render with "card-subtitle" class', () => {
const wrapper = shallow(<CardSubtitle>Yo!</CardSubtitle>);
expect(wrapper.text()).toBe('Yo!');
expect(wrapper.hasClass('card-subtitle')).toBe(true);
});
it('should render additional classes', () => {
const wrapper = shallow(<CardSubtitle className="other">Yo!</CardSubtitle>);
expect(wrapper.hasClass('other')).toBe(true);
expect(wrapper.hasClass('card-subtitle')).toBe(true);
});
it('should render custom tag', () => {
const wrapper = shallow(<CardSubtitle tag="h3">Yo!</CardSubtitle>);
expect(wrapper.text()).toBe('Yo!');
expect(wrapper.hasClass('card-subtitle')).toBe(true);
expect(wrapper.find('h3').length).toBe(1);
});
it('should render a "div" tag by default', () => {
const wrapper = shallow(<CardSubtitle>Yo!</CardSubtitle>);
expect(wrapper.find('div').length).toBe(1);
});
});