Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(carousel): fix error with deleting multiple slides at once
Browse files Browse the repository at this point in the history
  • Loading branch information
mokesmokes authored and ajoslin committed Jun 24, 2013
1 parent 6a4527b commit 3fcb70f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/carousel/carousel.js
Expand Up @@ -159,6 +159,8 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
} else {
self.select(slides[index]);
}
} else if (currentIndex > index) {
currentIndex--;
}
};
}])
Expand Down
8 changes: 5 additions & 3 deletions src/carousel/test/carousel.spec.js
Expand Up @@ -192,11 +192,13 @@ describe('carousel', function() {
});

it('should remove slide from dom and change active slide', function() {
scope.$apply('slides[1].active = true');
testSlideActive(1);
scope.$apply('slides.splice(1,1)');
scope.$apply('slides[2].active = true');
testSlideActive(2);
scope.$apply('slides.splice(0,1)');
expect(elm.find('div.item').length).toBe(2);
testSlideActive(1);
$timeout.flush();
testSlideActive(0);
scope.$apply('slides.splice(1,1)');
expect(elm.find('div.item').length).toBe(1);
testSlideActive(0);
Expand Down

0 comments on commit 3fcb70f

Please sign in to comment.