From 21e852b8ecdefb5471eb02c85d42280b3fedf15f Mon Sep 17 00:00:00 2001 From: Foxandxss Date: Sat, 24 Oct 2015 00:18:13 +0200 Subject: [PATCH] feat(alert): remove deprecated code BREAKING CHANGE: Remove deprecated non-prefixed directives Closes #4714 --- src/alert/alert.js | 38 ------------------------------------ src/alert/test/alert.spec.js | 34 -------------------------------- 2 files changed, 72 deletions(-) diff --git a/src/alert/alert.js b/src/alert/alert.js index 4b007c666a..dbea5c6893 100644 --- a/src/alert/alert.js +++ b/src/alert/alert.js @@ -28,41 +28,3 @@ angular.module('ui.bootstrap.alert', []) } }; }); - -/* Deprecated alert below */ - -angular.module('ui.bootstrap.alert') - - .value('$alertSuppressWarning', false) - - .controller('AlertController', ['$scope', '$attrs', '$controller', '$log', '$alertSuppressWarning', function($scope, $attrs, $controller, $log, $alertSuppressWarning) { - if (!$alertSuppressWarning) { - $log.warn('AlertController is now deprecated. Use UibAlertController instead.'); - } - - angular.extend(this, $controller('UibAlertController', { - $scope: $scope, - $attrs: $attrs - })); - }]) - - .directive('alert', ['$log', '$alertSuppressWarning', function($log, $alertSuppressWarning) { - return { - controller: 'AlertController', - controllerAs: 'alert', - templateUrl: function(element, attrs) { - return attrs.templateUrl || 'template/alert/alert.html'; - }, - transclude: true, - replace: true, - scope: { - type: '@', - close: '&' - }, - link: function() { - if (!$alertSuppressWarning) { - $log.warn('alert is now deprecated. Use uib-alert instead.'); - } - } - }; - }]); diff --git a/src/alert/test/alert.spec.js b/src/alert/test/alert.spec.js index 9946906a98..184fd0fdee 100644 --- a/src/alert/test/alert.spec.js +++ b/src/alert/test/alert.spec.js @@ -150,37 +150,3 @@ describe('uib-alert', function() { expect(scope.removeAlert).toHaveBeenCalled(); }); }); - -/* Deprecation tests below */ - -describe('alert deprecation', function() { - beforeEach(module('ui.bootstrap.alert')); - beforeEach(module('template/alert/alert.html')); - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$alertSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope) { - spyOn($log, 'warn'); - - var element = ''; - 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 = ''; - element = $compile(element)($rootScope); - $rootScope.$digest(); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['AlertController is now deprecated. Use UibAlertController instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['alert is now deprecated. Use uib-alert instead.']); - })); -});