')(scope);
+ elm = $compile(' ')(scope);
scope.$apply();
var select = elm.find('select');
@@ -728,12 +729,12 @@ describe('tabs', function() {
{title:'b', array:[2,3,4]},
{title:'c', array:[3,4,5]}
];
- elm = $compile('' +
- '' +
- '{{$index}} ' +
+ elm = $compile('' +
+ '' +
+ '{{$index}} ' +
'{{a}}, ' +
- '' +
- '
')(scope);
+ '' +
+ ' ')(scope);
scope.$apply();
var contents = elm.find('.tab-pane');
@@ -750,20 +751,20 @@ describe('tabs', function() {
var scope = $rootScope.$new();
elm = $compile([
'',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
'
'
].join('\n'))(scope);
scope.$apply();
@@ -780,27 +781,27 @@ describe('tabs', function() {
scope.tab2aaText = '456';
elm = $compile([
'',
- ' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
' {{ tab1aText }}',
- ' ',
- ' ',
+ ' ',
+ ' ',
' {{ tab1Text }} ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
' {{ tab2aaText }} ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
'
'
].join('\n'))(scope);
scope.$apply();
@@ -832,16 +833,16 @@ describe('tabs', function() {
];
elm = $compile([
'',
- ' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
' {{ innerTab.content }} ',
- ' ',
- ' ',
+ ' ',
+ ' ',
' {{ tab.content }} ',
- ' ',
- ' ',
+ ' ',
+ ' ',
'
'
].join('\n'))(scope);
scope.$apply();
@@ -852,3 +853,70 @@ describe('tabs', function() {
}));
});
});
+
+/* deprecation tests below */
+
+describe('tab deprecation', function() {
+ beforeEach(module('ui.bootstrap.tabs'));
+ beforeEach(module('template/tabs/tabset.html'));
+ beforeEach(module('template/tabs/tab.html'));
+
+ it('should suppress warning', function() {
+ module(function($provide) {
+ $provide.value('$tabsSuppressWarning', true);
+ });
+
+ inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element =
+ '' +
+ '' +
+ 'Tab Heading One ' +
+ 'Tab One Contents
' +
+ ' ' +
+ '' +
+ 'Tab Two Contents
' +
+ ' ' +
+ ' ';
+ $compile(element)($rootScope);
+ $rootScope.$digest();
+ expect($log.warn.calls.count()).toBe(0);
+ });
+ });
+
+ it('should give warning by default', inject(function($templateCache, $compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var tabSetTemplate =
+ '';
+ $templateCache.put('template/tabs/tabset.html', tabSetTemplate);
+
+ var tabTemplate =
+ '' +
+ '{{heading}} ' +
+ ' ';
+ $templateCache.put('template/tabs/tab.html', tabTemplate);
+
+ var element =
+ '' +
+ '' +
+ 'Tab Heading One ' +
+ 'Tab One Contents
' +
+ ' ' +
+ ' ';
+ $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.']);
+ }));
+});
diff --git a/template/tabs/tab.html b/template/tabs/tab.html
index d76dd67caf..0d8a42ed6b 100644
--- a/template/tabs/tab.html
+++ b/template/tabs/tab.html
@@ -1,3 +1,3 @@
- {{heading}}
+ {{heading}}
diff --git a/template/tabs/tabset.html b/template/tabs/tabset.html
index b953a49161..294c86a78b 100644
--- a/template/tabs/tabset.html
+++ b/template/tabs/tabset.html
@@ -4,7 +4,7 @@
+ uib-tab-content-transclude="tab">