@@ -45,7 +45,7 @@ describe('carousel', function() {
45
45
} ) ;
46
46
47
47
function testSlideActive ( slideIndex ) {
48
- for ( var i = 0 ; i < scope . slides . length ; i ++ ) {
48
+ for ( var i = 0 ; i < scope . slides . length ; i ++ ) {
49
49
if ( i == slideIndex ) {
50
50
expect ( scope . slides [ i ] . active ) . toBe ( true ) ;
51
51
} else {
@@ -143,7 +143,7 @@ describe('carousel', function() {
143
143
} ) ;
144
144
145
145
it ( 'should hide navigation when only one slide' , function ( ) {
146
- scope . slides = [ { active :false , content :'one' } ] ;
146
+ scope . slides = [ { active :false , content :'one' } ] ;
147
147
scope . $apply ( ) ;
148
148
elm = $compile (
149
149
'<uib-carousel interval="interval" no-transition="true">' +
@@ -302,7 +302,7 @@ describe('carousel', function() {
302
302
} ) ;
303
303
304
304
it ( 'should change dom when you reassign ng-repeat slides array' , function ( ) {
305
- scope . slides = [ { content :'new1' } , { content :'new2' } , { content :'new3' } ] ;
305
+ scope . slides = [ { content :'new1' } , { content :'new2' } , { content :'new3' } ] ;
306
306
scope . $apply ( ) ;
307
307
var contents = elm . find ( 'div.item' ) ;
308
308
expect ( contents . length ) . toBe ( 3 ) ;
@@ -339,6 +339,21 @@ describe('carousel', function() {
339
339
expect ( $interval . cancel ) . toHaveBeenCalled ( ) ;
340
340
} ) ;
341
341
342
+ it ( 'issue 4390 - should reset the currentTransition if there are no slides' , function ( ) {
343
+ var carouselScope = elm . children ( ) . scope ( ) ;
344
+ var next = elm . find ( 'a.right' ) ;
345
+ scope . slides = [ { content :'new1' } , { content :'new2' } , { content :'new3' } ] ;
346
+ scope . $apply ( ) ;
347
+
348
+ testSlideActive ( 0 ) ;
349
+ carouselScope . $currentTransition = true ;
350
+
351
+ scope . slides = [ ] ;
352
+ scope . $apply ( ) ;
353
+
354
+ expect ( carouselScope . $currentTransition ) . toBe ( null ) ;
355
+ } ) ;
356
+
342
357
describe ( 'slide order' , function ( ) {
343
358
344
359
beforeEach ( function ( ) {
0 commit comments