@@ -16,37 +16,38 @@ import {Observable} from 'rxjs/Observable';
1616
1717describe ( 'MdTabGroup' , ( ) => {
1818 let builder : TestComponentBuilder ;
19- let fixture : ComponentFixture < SimpleTabsTestApp > ;
2019
2120 beforeEach ( inject ( [ TestComponentBuilder ] , ( tcb : TestComponentBuilder ) => {
2221 builder = tcb ;
2322 } ) ) ;
2423
2524 describe ( 'basic behavior' , ( ) => {
25+ let fixture : ComponentFixture < SimpleTabsTestApp > ;
26+
2627 beforeEach ( async ( ( ) => {
2728 builder . createAsync ( SimpleTabsTestApp ) . then ( f => {
2829 fixture = f ;
2930 } ) ;
3031 } ) ) ;
3132
3233 it ( 'should default to the first tab' , ( ) => {
33- checkSelectedIndex ( 1 ) ;
34+ checkSelectedIndex ( 1 , fixture ) ;
3435 } ) ;
3536
3637 it ( 'should change selected index on click' , ( ) => {
3738 let component = fixture . debugElement . componentInstance ;
3839 component . selectedIndex = 0 ;
39- checkSelectedIndex ( 0 ) ;
40+ checkSelectedIndex ( 0 , fixture ) ;
4041
4142 // select the second tab
4243 let tabLabel = fixture . debugElement . queryAll ( By . css ( '.md-tab-label' ) ) [ 1 ] ;
4344 tabLabel . nativeElement . click ( ) ;
44- checkSelectedIndex ( 1 ) ;
45+ checkSelectedIndex ( 1 , fixture ) ;
4546
4647 // select the third tab
4748 tabLabel = fixture . debugElement . queryAll ( By . css ( '.md-tab-label' ) ) [ 2 ] ;
4849 tabLabel . nativeElement . click ( ) ;
49- checkSelectedIndex ( 2 ) ;
50+ checkSelectedIndex ( 2 , fixture ) ;
5051 } ) ;
5152
5253 it ( 'should support two-way binding for selectedIndex' , async ( ( ) => {
@@ -128,11 +129,11 @@ describe('MdTabGroup', () => {
128129
129130 spyOn ( component , 'handleSelection' ) . and . callThrough ( ) ;
130131
131- checkSelectedIndex ( 1 ) ;
132+ checkSelectedIndex ( 1 , fixture ) ;
132133
133134 tabComponent . selectedIndex = 2 ;
134135
135- checkSelectedIndex ( 2 ) ;
136+ checkSelectedIndex ( 2 , fixture ) ;
136137 tick ( ) ;
137138
138139 expect ( component . handleSelection ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -141,6 +142,8 @@ describe('MdTabGroup', () => {
141142 } ) ;
142143
143144 describe ( 'async tabs' , ( ) => {
145+ let fixture : ComponentFixture < AsyncTabsTestApp > ;
146+
144147 beforeEach ( async ( ( ) => {
145148 builder . createAsync ( AsyncTabsTestApp ) . then ( f => fixture = f ) ;
146149 } ) ) ;
@@ -164,7 +167,7 @@ describe('MdTabGroup', () => {
164167 * Checks that the `selectedIndex` has been updated; checks that the label and body have the
165168 * `md-active` class
166169 */
167- function checkSelectedIndex ( index : number ) {
170+ function checkSelectedIndex ( index : number , fixture : ComponentFixture < any > ) {
168171 fixture . detectChanges ( ) ;
169172
170173 let tabComponent : MdTabGroup = fixture . debugElement
0 commit comments