This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(carousel): use uib- prefix #4501
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,11 @@ describe('carousel', function() { | |
{active:false,content:'three'} | ||
]; | ||
elm = $compile( | ||
'<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'<uib-carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<uib-slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(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', '<div>foo</div>'); | ||
|
||
elm = $compile('<carousel template-url="foo/bar.html"></carousel>')(scope); | ||
elm = $compile('<uib-carousel template-url="foo/bar.html"></uib-carousel>')(scope); | ||
$rootScope.$digest(); | ||
|
||
expect(elm.html()).toBe('foo'); | ||
|
@@ -67,12 +67,12 @@ describe('carousel', function() { | |
$templateCache.put('foo/bar.html', '<div class="slide">bar</div>'); | ||
|
||
elm = $compile( | ||
'<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide template-url="foo/bar.html"></slide>' + | ||
'</carousel>' | ||
'<uib-carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<uib-slide template-url="foo/bar.html"></uib-slide>' + | ||
'</uib-carousel>' | ||
)(scope); | ||
$rootScope.$digest(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the whitespace |
||
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( | ||
'<carousel interval="interval" no-wrap="noWrap">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'<uib-carousel interval="interval" no-wrap="noWrap">' + | ||
'<uib-slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(scope); | ||
|
||
scope.noWrap = true; | ||
|
@@ -123,11 +123,11 @@ describe('carousel', function() { | |
|
||
it('should stop cycling slides backward when noWrap is truthy', function () { | ||
elm = $compile( | ||
'<carousel interval="interval" no-wrap="noWrap">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'<uib-carousel interval="interval" no-wrap="noWrap">' + | ||
'<uib-slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(scope); | ||
|
||
scope.noWrap = true; | ||
|
@@ -146,11 +146,11 @@ describe('carousel', function() { | |
scope.slides=[{active:false,content:'one'}]; | ||
scope.$apply(); | ||
elm = $compile( | ||
'<carousel interval="interval" no-transition="true">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'<uib-carousel interval="interval" no-transition="true">' + | ||
'<uib-slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(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( | ||
'<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide ng-repeat="slide in slides | orderBy: \'id\' " active="slide.active" index="$index">' + | ||
'<uib-carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<uib-slide ng-repeat="slide in slides | orderBy: \'id\' " active="slide.active" index="$index">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(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('<div></div>')}); | ||
ctrl = $controller('UibCarouselController', {$scope: scope, $element: angular.element('<div></div>')}); | ||
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', '<div>{{carousel.text}}</div>'); | ||
|
||
var scope = $rootScope.$new(); | ||
var elm = $compile('<carousel interval="bar" no-transition="false" no-pause="true"></carousel>')(scope); | ||
var elm = $compile('<uib-carousel interval="bar" no-transition="false" no-pause="true"></uib-carousel>')(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( | ||
'<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active" actual="slide">' + | ||
'<uib-carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<uib-slide ng-repeat="slide in slides" active="slide.active" actual="slide">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>' | ||
'</uib-slide>' + | ||
'</uib-carousel>' | ||
)(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 = '<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>'; | ||
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 = '<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide ng-repeat="slide in slides" active="slide.active">' + | ||
'{{slide.content}}' + | ||
'</slide>' + | ||
'</carousel>'; | ||
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 = '<carousel interval="interval" no-transition="true" no-pause="nopause">' + | ||
'<slide></slide>' + | ||
'</carousel>'; | ||
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.']); | ||
})); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove 3 of the lines