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

Commit

Permalink
fix(tabs): re-expose TabsetController
Browse files Browse the repository at this point in the history
- Re-expose `TabsetController` with deprecation notice

Closes #4530
  • Loading branch information
wesleycho committed Oct 3, 2015
1 parent aede646 commit 435924f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 11 additions & 1 deletion src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ angular.module('ui.bootstrap.tabs')

.value('$tabsSuppressWarning', false)

.controller('TabsetController', ['$scope', '$controller', '$log', '$tabsSuppressWarning', function($scope, $controller, $log, $tabsSuppressWarning) {
if (!$tabsSuppressWarning) {
$log.warn('TabsetController is now deprecated. Use UibTabsetController instead.');
}

angular.extend(this, $controller('UibTabsetController', {
$scope: $scope
}));
}])

.directive('tabset', ['$log', '$tabsSuppressWarning', function($log, $tabsSuppressWarning) {
return {
restrict: 'EA',
Expand All @@ -304,7 +314,7 @@ angular.module('ui.bootstrap.tabs')
scope: {
type: '@'
},
controller: 'UibTabsetController',
controller: 'TabsetController',
templateUrl: 'template/tabs/tabset.html',
link: function(scope, element, attrs) {

Expand Down
11 changes: 6 additions & 5 deletions src/tabs/test/tabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -913,10 +913,11 @@ describe('tab deprecation', function() {
$compile(element)($rootScope);
$rootScope.$digest();

expect($log.warn.calls.count()).toBe(4);
expect($log.warn.calls.argsFor(0)).toEqual(['tab-heading-transclude is now deprecated. Use uib-tab-heading-transclude instead.']);
expect($log.warn.calls.argsFor(1)).toEqual(['tab is now deprecated. Use uib-tab instead.']);
expect($log.warn.calls.argsFor(2)).toEqual(['tabset is now deprecated. Use uib-tabset instead.']);
expect($log.warn.calls.argsFor(3)).toEqual(['tab-content-transclude is now deprecated. Use uib-tab-content-transclude instead.']);
expect($log.warn.calls.count()).toBe(5);
expect($log.warn.calls.argsFor(0)).toEqual(['TabsetController is now deprecated. Use UibTabsetController instead.']);
expect($log.warn.calls.argsFor(1)).toEqual(['tab-heading-transclude is now deprecated. Use uib-tab-heading-transclude instead.']);
expect($log.warn.calls.argsFor(2)).toEqual(['tab is now deprecated. Use uib-tab instead.']);
expect($log.warn.calls.argsFor(3)).toEqual(['tabset is now deprecated. Use uib-tabset instead.']);
expect($log.warn.calls.argsFor(4)).toEqual(['tab-content-transclude is now deprecated. Use uib-tab-content-transclude instead.']);
}));
});

0 comments on commit 435924f

Please sign in to comment.