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

feat(alert): remove deprecated code #4714

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.']);
}));
});