diff --git a/src/carousel/test/carousel.spec.js b/src/carousel/test/carousel.spec.js
index 48bf9bcb34..e656c70548 100644
--- a/src/carousel/test/carousel.spec.js
+++ b/src/carousel/test/carousel.spec.js
@@ -33,11 +33,11 @@ describe('carousel', function() {
{active:false,content:'three'}
];
elm = $compile(
- '
' +
- '' +
+ '' +
+ '' +
'{{slide.content}}' +
- '' +
- ''
+ '' +
+ ''
)(scope);
scope.interval = 5000;
scope.nopause = undefined;
@@ -57,7 +57,7 @@ describe('carousel', function() {
it('should allow overriding of the carousel template', function() {
$templateCache.put('foo/bar.html', '
foo
');
- elm = $compile('
')(scope);
+ elm = $compile('
')(scope);
$rootScope.$digest();
expect(elm.html()).toBe('foo');
@@ -67,12 +67,12 @@ describe('carousel', function() {
$templateCache.put('foo/bar.html', '
bar
');
elm = $compile(
- '
' +
- '' +
- ''
+ '
' +
+ '' +
+ ''
)(scope);
$rootScope.$digest();
-
+
var slide = elm.find('.slide');
expect(slide.html()).toBe('bar');
});
@@ -99,11 +99,11 @@ describe('carousel', function() {
it('should stop cycling slides forward when noWrap is truthy', function () {
elm = $compile(
- '
' +
- '' +
+ '' +
+ '' +
'{{slide.content}}' +
- '' +
- ''
+ '' +
+ ''
)(scope);
scope.noWrap = true;
@@ -123,11 +123,11 @@ describe('carousel', function() {
it('should stop cycling slides backward when noWrap is truthy', function () {
elm = $compile(
- '
' +
- '' +
+ '' +
+ '' +
'{{slide.content}}' +
- '' +
- ''
+ '' +
+ ''
)(scope);
scope.noWrap = true;
@@ -146,11 +146,11 @@ describe('carousel', 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);
@@ -348,11 +348,11 @@ describe('carousel', function() {
{active:false,content:'three', id:3}
];
elm = $compile(
- '
' +
- '' +
+ '' +
+ '' +
'{{slide.content}}' +
- '' +
- ''
+ '' +
+ ''
)(scope);
scope.$apply();
scope.slides[0].id = 3;
@@ -418,7 +418,7 @@ describe('carousel', function() {
beforeEach(function() {
scope = $rootScope.$new();
- ctrl = $controller('CarouselController', {$scope: scope, $element: angular.element('
')});
+ ctrl = $controller('UibCarouselController', {$scope: scope, $element: angular.element('
')});
for(var i = 0;i < slides.length;i++){
ctrl.addSlide(slides[i]);
}
@@ -486,10 +486,10 @@ describe('carousel', function() {
$templateCache.put('template/carousel/carousel.html', '
{{carousel.text}}
');
var scope = $rootScope.$new();
- var elm = $compile('
')(scope);
+ var elm = $compile('
')(scope);
$rootScope.$digest();
- var ctrl = elm.controller('carousel');
+ var ctrl = elm.controller('uibCarousel');
expect(ctrl).toBeDefined();
@@ -508,18 +508,70 @@ describe('carousel', function() {
{active:false,content:'three'}
];
var elm = $compile(
- '
' +
- '' +
+ '' +
+ '' +
'{{slide.content}}' +
- '' +
- ''
+ '' +
+ ''
)(scope);
$rootScope.$digest();
- var ctrl = elm.controller('carousel');
+ var ctrl = elm.controller('uibCarousel');
expect(angular.equals(ctrl.slides.map(function(slide) {
return slide.actual;
}), scope.slides)).toBe(true);
});
});
+
+describe('carousel deprecation', function() {
+ beforeEach(module('ui.bootstrap.carousel'));
+ beforeEach(module('template/carousel/carousel.html', 'template/carousel/slide.html'));
+
+ it('should suppress warning', function() {
+ module(function($provide) {
+ $provide.value('$carouselSuppressWarning', true);
+ });
+
+ inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element = '
' +
+ '' +
+ '{{slide.content}}' +
+ '' +
+ '';
+ element = $compile(element)($rootScope);
+ $rootScope.$digest();
+ expect($log.warn.calls.count()).toBe(0);
+ });
+ });
+
+ it('should give warning by default', inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element = '
' +
+ '' +
+ '{{slide.content}}' +
+ '' +
+ '';
+ element = $compile(element)($rootScope);
+ $rootScope.$digest();
+
+ expect($log.warn.calls.count()).toBe(1);
+ expect($log.warn.calls.argsFor(0)).toEqual(['carousel is now deprecated. Use uib-carousel instead.']);
+ }));
+
+ it('should give warning by default for slider', inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element = '
' +
+ '' +
+ '';
+ element = $compile(element)($rootScope);
+ $rootScope.$digest();
+
+ expect($log.warn.calls.count()).toBe(2);
+ expect($log.warn.calls.argsFor(0)).toEqual(['slide is now deprecated. Use uib-slide instead.']);
+ }));
+});