@@ -153,6 +153,41 @@ describe('tabs', function() {
153153 } ) ;
154154 } ) ;
155155
156+ describe ( 'without active binding and index attributes' , function ( ) {
157+ beforeEach ( inject ( function ( $compile , $rootScope ) {
158+ scope = $rootScope . $new ( ) ;
159+ scope . first = '1' ;
160+ scope . second = '2' ;
161+ elm = $compile ( [
162+ '<uib-tabset>' ,
163+ ' <uib-tab heading="First Tab {{first}}">' ,
164+ ' first content is {{first}}' ,
165+ ' </uib-tab>' ,
166+ ' <uib-tab heading="Second Tab {{second}}">' ,
167+ ' second content is {{second}}' ,
168+ ' </uib-tab>' ,
169+ '</uib-tabset>'
170+ ] . join ( '\n' ) ) ( scope ) ;
171+ scope . $apply ( ) ;
172+ return elm ;
173+ } ) ) ;
174+
175+ it ( 'should bind tabs content and set first tab active' , function ( ) {
176+ expectContents ( [ 'first content is 1' , 'second content is 2' ] ) ;
177+ expect ( titles ( ) . eq ( 0 ) ) . toHaveClass ( 'active' ) ;
178+ expect ( titles ( ) . eq ( 1 ) ) . not . toHaveClass ( 'active' ) ;
179+ expect ( elm . controller ( 'uibTabset' ) . active ) . toBe ( 0 ) ;
180+ } ) ;
181+
182+ it ( 'should change active on click' , function ( ) {
183+ titles ( ) . eq ( 1 ) . find ( '> a' ) . click ( ) ;
184+ expect ( contents ( ) . eq ( 1 ) ) . toHaveClass ( 'active' ) ;
185+ expect ( titles ( ) . eq ( 0 ) ) . not . toHaveClass ( 'active' ) ;
186+ expect ( titles ( ) . eq ( 1 ) ) . toHaveClass ( 'active' ) ;
187+ expect ( elm . controller ( 'uibTabset' ) . active ) . toBe ( 1 ) ;
188+ } ) ;
189+ } ) ;
190+
156191 describe ( 'tab callback order' , function ( ) {
157192 var execOrder ;
158193 beforeEach ( inject ( function ( $compile , $rootScope ) {
@@ -579,7 +614,7 @@ describe('tabs', function() {
579614 describe ( 'remove' , function ( ) {
580615 it ( 'should remove title tabs when elements are destroyed and change selection' , inject ( function ( $controller , $compile , $rootScope ) {
581616 scope = $rootScope . $new ( ) ;
582- elm = $compile ( '<uib-tabset active="active"><uib-tab heading="1">Hello</uib-tab><uib-tab index="$index" ng-repeat="i in list" heading="tab {{i}}">content {{i}}</uib-tab></uib-tabset>' ) ( scope ) ;
617+ 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 ) ;
583618 scope . $apply ( ) ;
584619
585620 expectTitles ( [ '1' ] ) ;
0 commit comments