/
InputGroup.spec.js
49 lines (35 loc) · 1.41 KB
/
InputGroup.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from 'react';
import { shallow } from 'enzyme';
import { InputGroup } from '../';
import Dropdown from '../Dropdown';
describe('InputGroup', () => {
it('should render with "div" tag', () => {
const wrapper = shallow(<InputGroup>Yo!</InputGroup>);
expect(wrapper.type()).toBe('div');
});
it('should render children', () => {
const wrapper = shallow(<InputGroup>Yo!</InputGroup>);
expect(wrapper.text()).toBe('Yo!');
});
it('should render with "input-group" class', () => {
const wrapper = shallow(<InputGroup>Yo!</InputGroup>);
expect(wrapper.hasClass('input-group')).toBe(true);
});
it('should render with "input-group-${size}" class when size is passed', () => {
const wrapper = shallow(<InputGroup size="whatever">Yo!</InputGroup>);
expect(wrapper.hasClass('input-group-whatever')).toBe(true);
});
it('should render additional classes', () => {
const wrapper = shallow(<InputGroup className="other">Yo!</InputGroup>);
expect(wrapper.hasClass('other')).toBe(true);
expect(wrapper.hasClass('input-group')).toBe(true);
});
it('should render custom tag', () => {
const wrapper = shallow(<InputGroup tag="main">Yo!</InputGroup>);
expect(wrapper.type()).toBe('main');
});
it('should render Dropdown when type is dropdown', () => {
const wrapper = shallow(<InputGroup type="dropdown" />);
expect(wrapper.type()).toBe(Dropdown);
});
});