forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputGroupButton.spec.js
More file actions
57 lines (41 loc) · 2.14 KB
/
Copy pathInputGroupButton.spec.js
File metadata and controls
57 lines (41 loc) · 2.14 KB
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
50
51
52
53
54
55
56
57
import React from 'react';
import { shallow } from 'enzyme';
import { InputGroupButton, Button, InputGroupAddon } from '../';
describe('InputGroupButton', () => {
it('should render InputGroupAddon', () => {
const wrapper = shallow(<InputGroupButton addonType="append">Yo!</InputGroupButton>);
expect(wrapper.type()).toBe(InputGroupAddon);
});
describe('Standard usage', () => {
it('should render children provided', () => {
const wrapper = shallow(<InputGroupButton addonType="append"><span>Yo!</span></InputGroupButton>);
expect(wrapper.childAt(0).type()).toBe('span');
});
});
describe('Shorthand usage', () => {
it('should render a child Button', () => {
const wrapper = shallow(<InputGroupButton addonType="append">Yo!</InputGroupButton>);
expect(wrapper.childAt(0).type()).toBe(Button);
});
it('should render the string provided in the child Button', () => {
const wrapper = shallow(<InputGroupButton addonType="append">Yo!</InputGroupButton>);
expect(wrapper.childAt(0).prop('children')).toBe('Yo!');
});
it('should render additional props on the child Button', () => {
const wrapper = shallow(<InputGroupButton addonType="append" color="rad">Yo!</InputGroupButton>);
expect(wrapper.childAt(0).prop('color')).toBe('rad');
});
it('should render additional classes on the child Button', () => {
const wrapper = shallow(<InputGroupButton addonType="append" className="yo">Yo!</InputGroupButton>);
expect(wrapper.childAt(0).hasClass('yo')).toBe(true);
});
it('should render groupClassName as additional classes on the input-group-btn wrapper', () => {
const wrapper = shallow(<InputGroupButton addonType="append" groupClassName="other">Yo!</InputGroupButton>);
expect(wrapper.hasClass('other')).toBe(true);
});
it('should render groupAttributes as additional attributes on the input-group-btn wrapper', () => {
const wrapper = shallow(<InputGroupButton addonType="append" groupAttributes={{ style: { textAlign: 'left' } }}>Yo!</InputGroupButton>);
expect(wrapper.prop('style').textAlign).toBe('left');
});
});
});