forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMedia.spec.js
More file actions
130 lines (92 loc) · 3.06 KB
/
Copy pathMedia.spec.js
File metadata and controls
130 lines (92 loc) · 3.06 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import React from 'react';
import { shallow } from 'enzyme';
import { Media } from '../';
describe('Media', () => {
it('should render a div tag by default', () => {
const wrapper = shallow(<Media />);
expect(wrapper.type()).toBe('div');
});
it('should render an h4 tag by default for heading', () => {
const wrapper = shallow(<Media heading />);
expect(wrapper.type()).toBe('h4');
});
it('should render an a tag by default for left', () => {
const wrapper = shallow(<Media left />);
expect(wrapper.type()).toBe('a');
});
it('should render an a tag by default for right', () => {
const wrapper = shallow(<Media right />);
expect(wrapper.type()).toBe('a');
});
it('should render an img tag by default for object', () => {
const wrapper = shallow(<Media object />);
expect(wrapper.type()).toBe('img');
});
it('should render a ul tag by default for list', () => {
const wrapper = shallow(<Media list />);
expect(wrapper.type()).toBe('ul');
});
it('should pass additional classNames', () => {
const wrapper = shallow(<Media className="extra" />);
expect(wrapper.hasClass('extra')).toBe(true);
});
it('should render custom tag', () => {
const wrapper = shallow(<Media tag="main" />);
expect(wrapper.type()).toBe('main');
});
it('should render body', () => {
const wrapper = shallow(<Media body />);
expect(wrapper.hasClass('media-body')).toBe(true);
});
it('should render heading', () => {
const wrapper = shallow(<Media heading />);
expect(wrapper.hasClass('media-heading')).toBe(true);
});
it('should render left', () => {
const wrapper = shallow(<Media left />);
expect(wrapper.hasClass('media-left')).toBe(true);
});
it('should render right', () => {
const wrapper = shallow(<Media right />);
expect(wrapper.hasClass('media-right')).toBe(true);
});
it('should render top', () => {
const wrapper = shallow(<Media top />);
expect(wrapper.hasClass('media-top')).toBe(true);
});
it('should render bottom', () => {
const wrapper = shallow(<Media bottom />);
expect(wrapper.hasClass('media-bottom')).toBe(true);
});
it('should render middle', () => {
const wrapper = shallow(<Media middle />);
expect(wrapper.hasClass('media-middle')).toBe(true);
});
it('should render object', () => {
const wrapper = shallow(<Media object />);
expect(wrapper.hasClass('media-object')).toBe(true);
});
it('should render media', () => {
const wrapper = shallow(<Media />);
expect(wrapper.hasClass('media')).toBe(true);
});
it('should render list', () => {
const wrapper = shallow(
<Media list>
<Media tag="li" />
<Media tag="li" />
<Media tag="li" />
</Media>
);
expect(wrapper.hasClass('media-list')).toBe(true);
expect(wrapper.find({ tag: 'li' }).length).toBe(3);
});
it('should render children', () => {
const wrapper = shallow(
<Media>
<Media body />
</Media>
);
expect(wrapper.find({ body: true }).length).toBe(1);
});
});