diff --git a/src/carousel/test/carousel.spec.js b/src/carousel/test/carousel.spec.js index 6749c84b9b..a962bc15dc 100644 --- a/src/carousel/test/carousel.spec.js +++ b/src/carousel/test/carousel.spec.js @@ -63,6 +63,37 @@ describe('carousel', function() { var indicators = elm.find('ol.carousel-indicators > li'); expect(indicators.length).toBe(3); }); + + it('should hide navigation when only one slide', function () { + scope.slides=[{active:false,content:'one'}]; + scope.$apply(); + elm = $compile( + '' + + '' + + '{{slide.content}}' + + '' + + '' + )(scope); + var indicators = elm.find('ol.carousel-indicators > li'); + expect(indicators.length).toBe(0); + + var navNext = elm.find('a.right'); + expect(navNext.length).toBe(0); + + var navPrev = elm.find('a.left'); + expect(navPrev.length).toBe(0); + }); + + it('should show navigation when there are 3 slides', function () { + var indicators = elm.find('ol.carousel-indicators > li'); + expect(indicators.length).not.toBe(0); + + var navNext = elm.find('a.right'); + expect(navNext.length).not.toBe(0); + + var navPrev = elm.find('a.left'); + expect(navPrev.length).not.toBe(0); + }); it('should go to next when clicking next button', function() { var navNext = elm.find('a.right'); diff --git a/template/carousel/carousel.html b/template/carousel/carousel.html index aede73959e..97fad9f3f1 100644 --- a/template/carousel/carousel.html +++ b/template/carousel/carousel.html @@ -1,8 +1,8 @@