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

Commit 21e852b

Browse files
Foxandxsswesleycho
authored andcommitted
feat(alert): remove deprecated code
BREAKING CHANGE: Remove deprecated non-prefixed directives Closes #4714
1 parent 187f64c commit 21e852b

File tree

2 files changed

+0
-72
lines changed

2 files changed

+0
-72
lines changed

src/alert/alert.js

-38
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,3 @@ angular.module('ui.bootstrap.alert', [])
2828
}
2929
};
3030
});
31-
32-
/* Deprecated alert below */
33-
34-
angular.module('ui.bootstrap.alert')
35-
36-
.value('$alertSuppressWarning', false)
37-
38-
.controller('AlertController', ['$scope', '$attrs', '$controller', '$log', '$alertSuppressWarning', function($scope, $attrs, $controller, $log, $alertSuppressWarning) {
39-
if (!$alertSuppressWarning) {
40-
$log.warn('AlertController is now deprecated. Use UibAlertController instead.');
41-
}
42-
43-
angular.extend(this, $controller('UibAlertController', {
44-
$scope: $scope,
45-
$attrs: $attrs
46-
}));
47-
}])
48-
49-
.directive('alert', ['$log', '$alertSuppressWarning', function($log, $alertSuppressWarning) {
50-
return {
51-
controller: 'AlertController',
52-
controllerAs: 'alert',
53-
templateUrl: function(element, attrs) {
54-
return attrs.templateUrl || 'template/alert/alert.html';
55-
},
56-
transclude: true,
57-
replace: true,
58-
scope: {
59-
type: '@',
60-
close: '&'
61-
},
62-
link: function() {
63-
if (!$alertSuppressWarning) {
64-
$log.warn('alert is now deprecated. Use uib-alert instead.');
65-
}
66-
}
67-
};
68-
}]);

src/alert/test/alert.spec.js

-34
Original file line numberDiff line numberDiff line change
@@ -150,37 +150,3 @@ describe('uib-alert', function() {
150150
expect(scope.removeAlert).toHaveBeenCalled();
151151
});
152152
});
153-
154-
/* Deprecation tests below */
155-
156-
describe('alert deprecation', function() {
157-
beforeEach(module('ui.bootstrap.alert'));
158-
beforeEach(module('template/alert/alert.html'));
159-
160-
it('should suppress warning', function() {
161-
module(function($provide) {
162-
$provide.value('$alertSuppressWarning', true);
163-
});
164-
165-
inject(function($compile, $log, $rootScope) {
166-
spyOn($log, 'warn');
167-
168-
var element = '<alert></alert>';
169-
element = $compile(element)($rootScope);
170-
$rootScope.$digest();
171-
expect($log.warn.calls.count()).toBe(0);
172-
});
173-
});
174-
175-
it('should give warning by default', inject(function($compile, $log, $rootScope) {
176-
spyOn($log, 'warn');
177-
178-
var element = '<alert></alert>';
179-
element = $compile(element)($rootScope);
180-
$rootScope.$digest();
181-
182-
expect($log.warn.calls.count()).toBe(2);
183-
expect($log.warn.calls.argsFor(0)).toEqual(['AlertController is now deprecated. Use UibAlertController instead.']);
184-
expect($log.warn.calls.argsFor(1)).toEqual(['alert is now deprecated. Use uib-alert instead.']);
185-
}));
186-
});

0 commit comments

Comments
 (0)