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

Commit 435924f

Browse files
committed
fix(tabs): re-expose TabsetController
- Re-expose `TabsetController` with deprecation notice Closes #4530
1 parent aede646 commit 435924f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/tabs/tabs.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,16 @@ angular.module('ui.bootstrap.tabs')
296296

297297
.value('$tabsSuppressWarning', false)
298298

299+
.controller('TabsetController', ['$scope', '$controller', '$log', '$tabsSuppressWarning', function($scope, $controller, $log, $tabsSuppressWarning) {
300+
if (!$tabsSuppressWarning) {
301+
$log.warn('TabsetController is now deprecated. Use UibTabsetController instead.');
302+
}
303+
304+
angular.extend(this, $controller('UibTabsetController', {
305+
$scope: $scope
306+
}));
307+
}])
308+
299309
.directive('tabset', ['$log', '$tabsSuppressWarning', function($log, $tabsSuppressWarning) {
300310
return {
301311
restrict: 'EA',
@@ -304,7 +314,7 @@ angular.module('ui.bootstrap.tabs')
304314
scope: {
305315
type: '@'
306316
},
307-
controller: 'UibTabsetController',
317+
controller: 'TabsetController',
308318
templateUrl: 'template/tabs/tabset.html',
309319
link: function(scope, element, attrs) {
310320

src/tabs/test/tabs.spec.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,11 @@ describe('tab deprecation', function() {
913913
$compile(element)($rootScope);
914914
$rootScope.$digest();
915915

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

0 commit comments

Comments
 (0)