@@ -5,39 +5,53 @@ describe('carousel-slide', () => {
5
5
it ( 'has root element "div"' , async ( ) => {
6
6
const wrapper = mount ( CarouselSlide )
7
7
expect ( wrapper . is ( 'div' ) ) . toBe ( true )
8
+
9
+ wrapper . destroy ( )
8
10
} )
9
11
10
12
it ( 'has class carousel-item' , async ( ) => {
11
13
const wrapper = mount ( CarouselSlide )
12
14
expect ( wrapper . classes ( ) ) . toContain ( 'carousel-item' )
13
15
expect ( wrapper . classes ( ) . length ) . toBe ( 1 )
16
+
17
+ wrapper . destroy ( )
14
18
} )
15
19
16
20
it ( 'has role=listitem' , async ( ) => {
17
21
const wrapper = mount ( CarouselSlide )
18
22
expect ( wrapper . attributes ( 'role' ) ) . toBeDefined ( )
19
23
expect ( wrapper . attributes ( 'role' ) ) . toBe ( 'listitem' )
24
+
25
+ wrapper . destroy ( )
20
26
} )
21
27
22
28
it ( 'has child div.carousel-caption by default' , async ( ) => {
23
29
const wrapper = mount ( CarouselSlide )
24
30
expect ( wrapper . find ( '.carousel-caption' ) . exists ( ) ) . toBe ( true )
25
31
expect ( wrapper . find ( '.carousel-caption' ) . is ( 'div' ) ) . toBe ( true )
32
+
33
+ wrapper . destroy ( )
26
34
} )
27
35
28
36
it ( 'does not have image by default' , async ( ) => {
29
37
const wrapper = mount ( CarouselSlide )
30
38
expect ( wrapper . find ( 'img' ) . exists ( ) ) . toBe ( false )
39
+
40
+ wrapper . destroy ( )
31
41
} )
32
42
33
43
it ( 'does not have caption tag h3 by default' , async ( ) => {
34
44
const wrapper = mount ( CarouselSlide )
35
45
expect ( wrapper . find ( 'h3' ) . exists ( ) ) . toBe ( false )
46
+
47
+ wrapper . destroy ( )
36
48
} )
37
49
38
50
it ( 'does not have text tag p by default' , async ( ) => {
39
51
const wrapper = mount ( CarouselSlide )
40
52
expect ( wrapper . find ( 'p' ) . exists ( ) ) . toBe ( false )
53
+
54
+ wrapper . destroy ( )
41
55
} )
42
56
43
57
it ( 'renders default slot inside carousel-caption' , async ( ) => {
@@ -48,6 +62,8 @@ describe('carousel-slide', () => {
48
62
} )
49
63
expect ( wrapper . find ( '.carousel-caption' ) . exists ( ) ) . toBe ( true )
50
64
expect ( wrapper . find ( '.carousel-caption' ) . text ( ) ) . toContain ( 'foobar' )
65
+
66
+ wrapper . destroy ( )
51
67
} )
52
68
53
69
it ( 'has caption tag h3 when prop caption is set' , async ( ) => {
@@ -59,6 +75,8 @@ describe('carousel-slide', () => {
59
75
const content = wrapper . find ( '.carousel-caption' )
60
76
expect ( content . find ( 'h3' ) . exists ( ) ) . toBe ( true )
61
77
expect ( content . find ( 'h3' ) . text ( ) ) . toBe ( 'foobar' )
78
+
79
+ wrapper . destroy ( )
62
80
} )
63
81
64
82
it ( 'has text tag p when prop text is set' , async ( ) => {
@@ -70,6 +88,8 @@ describe('carousel-slide', () => {
70
88
const content = wrapper . find ( '.carousel-caption' )
71
89
expect ( content . find ( 'p' ) . exists ( ) ) . toBe ( true )
72
90
expect ( content . find ( 'p' ) . text ( ) ) . toBe ( 'foobar' )
91
+
92
+ wrapper . destroy ( )
73
93
} )
74
94
75
95
it ( 'has custom content tag when prop contentTag is set' , async ( ) => {
@@ -80,6 +100,8 @@ describe('carousel-slide', () => {
80
100
} )
81
101
expect ( wrapper . find ( '.carousel-caption' ) . exists ( ) ) . toBe ( true )
82
102
expect ( wrapper . find ( '.carousel-caption' ) . is ( 'span' ) ) . toBe ( true )
103
+
104
+ wrapper . destroy ( )
83
105
} )
84
106
85
107
it ( 'has display classes on .carousel-caption when prop contentVisibleUp is set' , async ( ) => {
@@ -92,6 +114,8 @@ describe('carousel-slide', () => {
92
114
expect ( wrapper . find ( '.carousel-caption' ) . classes ( ) ) . toContain ( 'd-none' )
93
115
expect ( wrapper . find ( '.carousel-caption' ) . classes ( ) ) . toContain ( 'd-lg-block' )
94
116
expect ( wrapper . find ( '.carousel-caption' ) . classes ( ) . length ) . toBe ( 3 )
117
+
118
+ wrapper . destroy ( )
95
119
} )
96
120
97
121
it ( 'does not have style background when prop background not set' , async ( ) => {
@@ -103,6 +127,8 @@ describe('carousel-slide', () => {
103
127
// But just in case that changes in the future
104
128
expect ( true ) . toBe ( true )
105
129
}
130
+
131
+ wrapper . destroy ( )
106
132
} )
107
133
108
134
it ( 'has style background when prop background is set' , async ( ) => {
@@ -114,6 +140,8 @@ describe('carousel-slide', () => {
114
140
expect ( wrapper . attributes ( 'style' ) ) . toBeDefined ( )
115
141
expect ( wrapper . attributes ( 'style' ) ) . toContain ( 'background:' )
116
142
expect ( wrapper . attributes ( 'style' ) ) . toContain ( 'rgb(' )
143
+
144
+ wrapper . destroy ( )
117
145
} )
118
146
119
147
it ( 'has style background inherited from carousel parent' , async ( ) => {
@@ -127,6 +155,8 @@ describe('carousel-slide', () => {
127
155
expect ( wrapper . attributes ( 'style' ) ) . toBeDefined ( )
128
156
expect ( wrapper . attributes ( 'style' ) ) . toContain ( 'background:' )
129
157
expect ( wrapper . attributes ( 'style' ) ) . toContain ( 'rgb(' )
158
+
159
+ wrapper . destroy ( )
130
160
} )
131
161
132
162
it ( 'has custom caption tag when prop captionTag is set' , async ( ) => {
@@ -139,6 +169,8 @@ describe('carousel-slide', () => {
139
169
const content = wrapper . find ( '.carousel-caption' )
140
170
expect ( content . find ( 'h1' ) . exists ( ) ) . toBe ( true )
141
171
expect ( content . find ( 'h1' ) . text ( ) ) . toBe ( 'foobar' )
172
+
173
+ wrapper . destroy ( )
142
174
} )
143
175
144
176
it ( 'has custom text tag when prop textTag is set' , async ( ) => {
@@ -151,6 +183,8 @@ describe('carousel-slide', () => {
151
183
const content = wrapper . find ( '.carousel-caption' )
152
184
expect ( content . find ( 'span' ) . exists ( ) ) . toBe ( true )
153
185
expect ( content . find ( 'span' ) . text ( ) ) . toBe ( 'foobar' )
186
+
187
+ wrapper . destroy ( )
154
188
} )
155
189
156
190
it ( 'has image when prop img-src is set' , async ( ) => {
@@ -162,6 +196,8 @@ describe('carousel-slide', () => {
162
196
expect ( wrapper . find ( 'img' ) . exists ( ) ) . toBe ( true )
163
197
expect ( wrapper . find ( 'img' ) . attributes ( 'src' ) ) . toBeDefined ( )
164
198
expect ( wrapper . find ( 'img' ) . attributes ( 'src' ) ) . toBe ( 'https://picsum.photos/1024/480/?image=52' )
199
+
200
+ wrapper . destroy ( )
165
201
} )
166
202
167
203
it ( 'has image when prop img-blank is set' , async ( ) => {
@@ -173,6 +209,8 @@ describe('carousel-slide', () => {
173
209
expect ( wrapper . find ( 'img' ) . exists ( ) ) . toBe ( true )
174
210
expect ( wrapper . find ( 'img' ) . attributes ( 'src' ) ) . toBeDefined ( )
175
211
expect ( wrapper . find ( 'img' ) . attributes ( 'src' ) ) . toContain ( 'data:' )
212
+
213
+ wrapper . destroy ( )
176
214
} )
177
215
178
216
it ( 'has image with alt attribute when prop img-alt is set' , async ( ) => {
@@ -186,6 +224,8 @@ describe('carousel-slide', () => {
186
224
expect ( wrapper . find ( 'img' ) . attributes ( 'src' ) ) . toBeDefined ( )
187
225
expect ( wrapper . find ( 'img' ) . attributes ( 'alt' ) ) . toBeDefined ( )
188
226
expect ( wrapper . find ( 'img' ) . attributes ( 'alt' ) ) . toBe ( 'foobar' )
227
+
228
+ wrapper . destroy ( )
189
229
} )
190
230
191
231
it ( 'has image with width and height attrs when props img-width and img-height are set' , async ( ) => {
@@ -202,6 +242,8 @@ describe('carousel-slide', () => {
202
242
expect ( wrapper . find ( 'img' ) . attributes ( 'width' ) ) . toBe ( '1024' )
203
243
expect ( wrapper . find ( 'img' ) . attributes ( 'height' ) ) . toBeDefined ( )
204
244
expect ( wrapper . find ( 'img' ) . attributes ( 'height' ) ) . toBe ( '480' )
245
+
246
+ wrapper . destroy ( )
205
247
} )
206
248
207
249
it ( 'has image with width and height attrs inherited from carousel parent' , async ( ) => {
@@ -223,5 +265,7 @@ describe('carousel-slide', () => {
223
265
expect ( wrapper . find ( 'img' ) . attributes ( 'width' ) ) . toBe ( '1024' )
224
266
expect ( wrapper . find ( 'img' ) . attributes ( 'height' ) ) . toBeDefined ( )
225
267
expect ( wrapper . find ( 'img' ) . attributes ( 'height' ) ) . toBe ( '480' )
268
+
269
+ wrapper . destroy ( )
226
270
} )
227
271
} )
0 commit comments