|
1 |
| -describe('tabs', function() { |
| 1 | +fdescribe('tabs', function() { |
2 | 2 | var elm, scope;
|
3 | 3 |
|
4 | 4 | beforeEach(module('ui.bootstrap.tabs'));
|
@@ -670,6 +670,31 @@ describe('tabs', function() {
|
670 | 670 | expect(contents().eq(1)).toHaveClass('active');
|
671 | 671 | }));
|
672 | 672 |
|
| 673 | + it('should use updated index in tab', inject(function($controller, $compile, $rootScope) { |
| 674 | + scope = $rootScope.$new(); |
| 675 | + elm = $compile('<uib-tabset active="active"><uib-tab index="0" heading="1">Hello</uib-tab><uib-tab index="$index + 1" ng-repeat="i in list" heading="tab {{i}}">content {{i}}</uib-tab></uib-tabset>')(scope); |
| 676 | + scope.$apply(); |
| 677 | + |
| 678 | + scope.$apply('list = [1,2,3]'); |
| 679 | + expectTitles(['1', 'tab 1', 'tab 2', 'tab 3']); |
| 680 | + expectContents(['Hello', 'content 1', 'content 2', 'content 3']); |
| 681 | + |
| 682 | + // Remove middle "tab 2" tab |
| 683 | + scope.$apply('list = [1,3]'); |
| 684 | + expectTitles(['1', 'tab 1', 'tab 3']); |
| 685 | + expectContents(['Hello', 'content 1', 'content 3']); |
| 686 | + |
| 687 | + // Remove last "tab 3" tab |
| 688 | + scope.$apply('list = [1]'); |
| 689 | + expectTitles(['1', 'tab 1']); |
| 690 | + expectContents(['Hello', 'content 1']); |
| 691 | + |
| 692 | + // Select first tab |
| 693 | + titles().find('> a').eq(0).click(); |
| 694 | + expect(titles().eq(0)).toHaveClass('active'); |
| 695 | + expect(contents().eq(0)).toHaveClass('active'); |
| 696 | + })); |
| 697 | + |
673 | 698 | it('should not select tabs when being destroyed', inject(function($controller, $compile, $rootScope) {
|
674 | 699 | var selectList = [],
|
675 | 700 | deselectList = [],
|
|
0 commit comments