@@ -31,7 +31,7 @@ describe('<Carousel>', () => {
31
31
32
32
expect ( carouselItems . at ( 0 ) . is ( '.active' ) ) . to . be . true ;
33
33
expect ( carouselItems . at ( 1 ) . is ( '.active' ) ) . to . be . false ;
34
- expect ( wrapper . find ( '.carousel-indicators > li ' ) ) . to . have . lengthOf (
34
+ expect ( wrapper . find ( '.carousel-indicators > button ' ) ) . to . have . lengthOf (
35
35
items . length ,
36
36
) ;
37
37
} ) ;
@@ -60,7 +60,7 @@ describe('<Carousel>', () => {
60
60
61
61
expect ( carouselItems . at ( 0 ) . is ( '.active' ) ) . to . be . true ;
62
62
expect ( carouselItems . at ( 0 ) . text ( ) ) . to . equal ( 'Item 1 content' ) ;
63
- expect ( wrapper . find ( '.carousel-indicators > li ' ) ) . to . have . lengthOf ( 2 ) ;
63
+ expect ( wrapper . find ( '.carousel-indicators > button ' ) ) . to . have . lengthOf ( 2 ) ;
64
64
} ) ;
65
65
66
66
it ( 'should call onSelect when indicator selected' , ( done ) => {
@@ -76,7 +76,23 @@ describe('<Carousel>', () => {
76
76
</ Carousel > ,
77
77
) ;
78
78
79
- wrapper . find ( '.carousel-indicators li' ) . first ( ) . simulate ( 'click' ) ;
79
+ wrapper . find ( '.carousel-indicators button' ) . first ( ) . simulate ( 'click' ) ;
80
+ } ) ;
81
+
82
+ it ( 'should render custom indicator labels' , ( ) => {
83
+ const labels = [ 'custom1' , 'custom2' , 'custom3' ] ;
84
+
85
+ const wrapper = mount (
86
+ < Carousel activeIndex = { 1 } interval = { null } indicatorLabels = { labels } >
87
+ { items }
88
+ </ Carousel > ,
89
+ ) ;
90
+
91
+ const indicators = wrapper . find ( '.carousel-indicators button' ) ;
92
+ for ( let i = 0 ; i < labels . length ; i ++ ) {
93
+ const node = indicators . at ( i ) . getDOMNode ( ) ;
94
+ expect ( node . getAttribute ( 'aria-label' ) ) . to . equal ( labels [ i ] ) ;
95
+ }
80
96
} ) ;
81
97
82
98
it ( 'should render variant' , ( ) => {
@@ -137,7 +153,7 @@ describe('<Carousel>', () => {
137
153
</ Carousel > ,
138
154
) ;
139
155
140
- wrapper . find ( '.carousel-indicators li ' ) . first ( ) . simulate ( 'click' ) ;
156
+ wrapper . find ( '.carousel-indicators button ' ) . first ( ) . simulate ( 'click' ) ;
141
157
} ) ;
142
158
143
159
it ( `should call ${ eventName } with next index and direction` , ( done ) => {
@@ -159,7 +175,7 @@ describe('<Carousel>', () => {
159
175
</ Carousel > ,
160
176
) ;
161
177
162
- wrapper . find ( '.carousel-indicators li ' ) . last ( ) . simulate ( 'click' ) ;
178
+ wrapper . find ( '.carousel-indicators button ' ) . last ( ) . simulate ( 'click' ) ;
163
179
} ) ;
164
180
} ) ;
165
181
@@ -289,15 +305,15 @@ describe('<Carousel>', () => {
289
305
< Carousel defaultActiveIndex = { items . length - 1 } > { items } </ Carousel > ,
290
306
) ;
291
307
292
- expect ( wrapper . find ( '.carousel-indicators > li ' ) ) . to . have . lengthOf (
308
+ expect ( wrapper . find ( '.carousel-indicators > button ' ) ) . to . have . lengthOf (
293
309
items . length ,
294
310
) ;
295
311
296
312
let fewerItems = items . slice ( 2 ) ;
297
313
298
314
wrapper . setProps ( { children : fewerItems } ) ;
299
315
300
- expect ( wrapper . find ( '.carousel-indicators > li ' ) ) . to . have . lengthOf (
316
+ expect ( wrapper . find ( '.carousel-indicators > button ' ) ) . to . have . lengthOf (
301
317
fewerItems . length ,
302
318
) ;
303
319
expect ( wrapper . find ( 'div.carousel-item' ) ) . to . have . lengthOf (
0 commit comments