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

Commit

Permalink
feat(alert): remove deprecated code
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove deprecated non-prefixed directives

Closes #4714
  • Loading branch information
Foxandxss authored and wesleycho committed Oct 23, 2015
1 parent 187f64c commit 21e852b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
38 changes: 0 additions & 38 deletions src/alert/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
};
}]);
34 changes: 0 additions & 34 deletions src/alert/test/alert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<alert></alert>';
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 = '<alert></alert>';
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.']);
}));
});

0 comments on commit 21e852b

Please sign in to comment.