|
| 1 | +describe('progressbar directive', function() { |
| 2 | + describe('$progressSuppressWarning', function() { |
| 3 | + beforeEach(module('ui.bootstrap.progressbar')); |
| 4 | + beforeEach(module('template/progressbar/progress.html', 'template/progressbar/bar.html')); |
| 5 | + |
| 6 | + it('should give warning', inject(function($compile, $log, $rootScope) { |
| 7 | + spyOn($log, 'warn'); |
| 8 | + |
| 9 | + $rootScope.objects = [ |
| 10 | + { value: 10, type: 'success' }, |
| 11 | + { value: 50, type: 'warning' }, |
| 12 | + { value: 20 } |
| 13 | + ]; |
| 14 | + var element = $compile('<progress animate="false"><bar ng-repeat="o in objects" value="o.value" type="{{o.type}}">{{o.value}}</bar></progress>')($rootScope); |
| 15 | + $rootScope.$digest(); |
| 16 | + |
| 17 | + expect($log.warn.calls.count()).toBe(0); |
| 18 | + })); |
| 19 | + |
| 20 | + it('should suppress warning', function() { |
| 21 | + module(function($provide) { |
| 22 | + $provide.value('$progressSuppressWarning', true); |
| 23 | + }); |
| 24 | + |
| 25 | + inject(function($compile, $log, $rootScope) { |
| 26 | + spyOn($log, 'warn'); |
| 27 | + |
| 28 | + $rootScope.objects = [ |
| 29 | + { value: 10, type: 'success' }, |
| 30 | + { value: 50, type: 'warning' }, |
| 31 | + { value: 20 } |
| 32 | + ]; |
| 33 | + var element = $compile('<progress animate="false"><bar ng-repeat="o in objects" value="o.value" type="{{o.type}}">{{o.value}}</bar></progress>')($rootScope); |
| 34 | + $rootScope.$digest(); |
| 35 | + |
| 36 | + expect($log.warn.calls.count()).toBe(4); |
| 37 | + expect($log.warn.calls.argsFor(0)).toEqual(['progress is now deprecated. Use uib-progress instead']); |
| 38 | + expect($log.warn.calls.argsFor(1)).toEqual(['bar is now deprecated. Use uib-bar instead']); |
| 39 | + expect($log.warn.calls.argsFor(2)).toEqual(['bar is now deprecated. Use uib-bar instead']); |
| 40 | + expect($log.warn.calls.argsFor(3)).toEqual(['bar is now deprecated. Use uib-bar instead']); |
| 41 | + }); |
| 42 | + }); |
| 43 | + }); |
| 44 | +}); |
| 45 | + |
1 | 46 | describe('progressbar directive', function() {
|
2 | 47 | var $rootScope, $compile, element;
|
3 | 48 | beforeEach(module('ui.bootstrap.progressbar'));
|
@@ -156,7 +201,7 @@ describe('progressbar directive', function() {
|
156 | 201 | { value: 50, type: 'warning' },
|
157 | 202 | { value: 20 }
|
158 | 203 | ];
|
159 |
| - element = $compile('<progress animate="false"><bar ng-repeat="o in objects" value="o.value" type="{{o.type}}">{{o.value}}</bar></progress>')($rootScope); |
| 204 | + element = $compile('<uib-progress animate="false"><uib-bar ng-repeat="o in objects" value="o.value" type="{{o.type}}">{{o.value}}</uib-bar></uib-progress>')($rootScope); |
160 | 205 | $rootScope.$digest();
|
161 | 206 | }));
|
162 | 207 |
|
@@ -219,7 +264,7 @@ describe('progressbar directive', function() {
|
219 | 264 | describe('"max" attribute', function() {
|
220 | 265 | beforeEach(inject(function() {
|
221 | 266 | $rootScope.max = 200;
|
222 |
| - element = $compile('<progress max="max" animate="false"><bar ng-repeat="o in objects" value="o.value">{{o.value}}/{{max}}</bar></progress>')($rootScope); |
| 267 | + element = $compile('<uib-progress max="max" animate="false"><uib-bar ng-repeat="o in objects" value="o.value">{{o.value}}/{{max}}</uib-bar></uib-progress>')($rootScope); |
223 | 268 | $rootScope.$digest();
|
224 | 269 | }));
|
225 | 270 |
|
|
0 commit comments