forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUncontrolled.spec.js
More file actions
112 lines (96 loc) · 3.77 KB
/
Copy pathUncontrolled.spec.js
File metadata and controls
112 lines (96 loc) · 3.77 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import React from 'react';
import { shallow } from 'enzyme';
import {
Alert,
ButtonDropdown,
Dropdown,
Tooltip,
UncontrolledAlert,
UncontrolledButtonDropdown,
UncontrolledDropdown,
UncontrolledTooltip,
} from '../';
describe('UncontrolledAlert', () => {
it('should be an Alert', () => {
const alert = shallow(<UncontrolledAlert>Yo!</UncontrolledAlert>);
expect(alert.type()).toBe(Alert);
});
it('should have isOpen default to true', () => {
const alert = shallow(<UncontrolledAlert>Yo!</UncontrolledAlert>);
expect(alert.prop('isOpen')).toBe(true);
});
it('should have toggle function', () => {
const alert = shallow(<UncontrolledAlert>Yo!</UncontrolledAlert>);
expect(alert.prop('toggle')).toEqual(expect.any(Function));
});
it('should toggle isOpen when toggle is called', () => {
const alert = shallow(<UncontrolledAlert>Yo!</UncontrolledAlert>);
const instance = alert.instance();
instance.toggle();
alert.update();
expect(alert.prop('isOpen')).toBe(false);
});
});
describe('UncontrolledButtonDropdown', () => {
it('should be an ButtonDropdown', () => {
const buttonDropdown = shallow(<UncontrolledButtonDropdown>Yo!</UncontrolledButtonDropdown>);
expect(buttonDropdown.type()).toBe(ButtonDropdown);
});
it('should have isOpen default to false', () => {
const buttonDropdown = shallow(<UncontrolledButtonDropdown>Yo!</UncontrolledButtonDropdown>);
expect(buttonDropdown.prop('isOpen')).toBe(false);
});
it('should have toggle function', () => {
const buttonDropdown = shallow(<UncontrolledButtonDropdown>Yo!</UncontrolledButtonDropdown>);
expect(buttonDropdown.prop('toggle')).toEqual(expect.any(Function));
});
it('should toggle isOpen when toggle is called', () => {
const buttonDropdown = shallow(<UncontrolledButtonDropdown>Yo!</UncontrolledButtonDropdown>);
const instance = buttonDropdown.instance();
instance.toggle();
buttonDropdown.update();
expect(buttonDropdown.prop('isOpen')).toBe(true);
});
});
describe('UncontrolledDropdown', () => {
it('should be an Dropdown', () => {
const dropdown = shallow(<UncontrolledDropdown>Yo!</UncontrolledDropdown>);
expect(dropdown.type()).toBe(Dropdown);
});
it('should have isOpen default to false', () => {
const dropdown = shallow(<UncontrolledDropdown>Yo!</UncontrolledDropdown>);
expect(dropdown.prop('isOpen')).toBe(false);
});
it('should have toggle function', () => {
const dropdown = shallow(<UncontrolledDropdown>Yo!</UncontrolledDropdown>);
expect(dropdown.prop('toggle')).toEqual(expect.any(Function));
});
it('should toggle isOpen when toggle is called', () => {
const dropdown = shallow(<UncontrolledDropdown>Yo!</UncontrolledDropdown>);
const instance = dropdown.instance();
instance.toggle();
dropdown.update();
expect(dropdown.prop('isOpen')).toBe(true);
});
});
describe('UncontrolledTooltip', () => {
it('should be an Tooltip', () => {
const tooltip = shallow(<UncontrolledTooltip target="blah">Yo!</UncontrolledTooltip>);
expect(tooltip.type()).toBe(Tooltip);
});
it('should have isOpen default to false', () => {
const tooltip = shallow(<UncontrolledTooltip target="blah">Yo!</UncontrolledTooltip>);
expect(tooltip.prop('isOpen')).toBe(false);
});
it('should have toggle function', () => {
const tooltip = shallow(<UncontrolledTooltip target="blah">Yo!</UncontrolledTooltip>);
expect(tooltip.prop('toggle')).toEqual(expect.any(Function));
});
it('should toggle isOpen when toggle is called', () => {
const tooltip = shallow(<UncontrolledTooltip target="blah">Yo!</UncontrolledTooltip>);
const instance = tooltip.instance();
instance.toggle();
tooltip.update();
expect(tooltip.prop('isOpen')).toBe(true);
});
});