@@ -9,6 +9,7 @@ import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/
9
9
import { MdStepperNext , MdStepperPrevious } from './stepper-button' ;
10
10
import { dispatchKeyboardEvent } from '@angular/cdk/testing' ;
11
11
import { ENTER , LEFT_ARROW , RIGHT_ARROW , SPACE } from '@angular/cdk/keycodes' ;
12
+ import { MdStepper } from './stepper' ;
12
13
13
14
describe ( 'MdHorizontalStepper' , ( ) => {
14
15
beforeEach ( async ( ( ) => {
@@ -26,7 +27,6 @@ describe('MdHorizontalStepper', () => {
26
27
describe ( 'basic horizontal stepper' , ( ) => {
27
28
let fixture : ComponentFixture < SimpleMdHorizontalStepperApp > ;
28
29
let stepperComponent : MdHorizontalStepper ;
29
- let stepperEl : HTMLElement ;
30
30
31
31
beforeEach ( ( ) => {
32
32
fixture = TestBed . createComponent ( SimpleMdHorizontalStepperApp ) ;
@@ -47,7 +47,7 @@ describe('MdHorizontalStepper', () => {
47
47
} ) ;
48
48
49
49
it ( 'should set the "tablist" role on stepper' , ( ) => {
50
- stepperEl = fixture . debugElement . query ( By . css ( 'md-horizontal-stepper' ) ) . nativeElement ;
50
+ let stepperEl = fixture . debugElement . query ( By . css ( 'md-horizontal-stepper' ) ) . nativeElement ;
51
51
expect ( stepperEl . getAttribute ( 'role' ) ) . toBe ( 'tablist' ) ;
52
52
} ) ;
53
53
@@ -125,7 +125,6 @@ describe('MdVerticalStepper', () => {
125
125
describe ( 'basic vertical stepper' , ( ) => {
126
126
let fixture : ComponentFixture < SimpleMdVerticalStepperApp > ;
127
127
let stepperComponent : MdVerticalStepper ;
128
- let stepperEl : HTMLElement ;
129
128
130
129
beforeEach ( ( ) => {
131
130
fixture = TestBed . createComponent ( SimpleMdVerticalStepperApp ) ;
@@ -146,7 +145,7 @@ describe('MdVerticalStepper', () => {
146
145
} ) ;
147
146
148
147
it ( 'should set the "tablist" role on stepper' , ( ) => {
149
- stepperEl = fixture . debugElement . query ( By . css ( 'md-vertical-stepper' ) ) . nativeElement ;
148
+ let stepperEl = fixture . debugElement . query ( By . css ( 'md-vertical-stepper' ) ) . nativeElement ;
150
149
expect ( stepperEl . getAttribute ( 'role' ) ) . toBe ( 'tablist' ) ;
151
150
} ) ;
152
151
@@ -209,8 +208,7 @@ describe('MdVerticalStepper', () => {
209
208
} ) ;
210
209
} ) ;
211
210
212
- function checkSelectionChangeOnHeaderClick ( stepperComponent :
213
- MdHorizontalStepper | MdVerticalStepper ,
211
+ function checkSelectionChangeOnHeaderClick ( stepperComponent : MdStepper ,
214
212
fixture : ComponentFixture < any > ,
215
213
stepHeaders : DebugElement [ ] ) {
216
214
expect ( stepperComponent . selectedIndex ) . toBe ( 0 ) ;
@@ -230,7 +228,7 @@ function checkSelectionChangeOnHeaderClick(stepperComponent:
230
228
expect ( stepperComponent . selectedIndex ) . toBe ( 2 ) ;
231
229
}
232
230
233
- function checkExpandedContent ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
231
+ function checkExpandedContent ( stepperComponent : MdStepper ,
234
232
fixture : ComponentFixture < any > ,
235
233
stepContents : DebugElement [ ] ) {
236
234
let firstStepContentEl = stepContents [ 0 ] . nativeElement ;
@@ -244,8 +242,7 @@ function checkExpandedContent(stepperComponent: MdHorizontalStepper | MdVertical
244
242
expect ( secondStepContentEl . getAttribute ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
245
243
}
246
244
247
- function checkCorrectLabel ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
248
- fixture : ComponentFixture < any > ) {
245
+ function checkCorrectLabel ( stepperComponent : MdStepper , fixture : ComponentFixture < any > ) {
249
246
let selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true"]' ) ;
250
247
expect ( selectedLabel . textContent ) . toMatch ( 'Step 1' ) ;
251
248
@@ -262,8 +259,7 @@ function checkCorrectLabel(stepperComponent: MdHorizontalStepper | MdVerticalSte
262
259
expect ( selectedLabel . textContent ) . toMatch ( 'New Label' ) ;
263
260
}
264
261
265
- function checkNextStepperButton ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
266
- fixture : ComponentFixture < any > ) {
262
+ function checkNextStepperButton ( stepperComponent : MdStepper , fixture : ComponentFixture < any > ) {
267
263
expect ( stepperComponent . selectedIndex ) . toBe ( 0 ) ;
268
264
269
265
let nextButtonNativeEl = fixture . debugElement
@@ -288,8 +284,7 @@ function checkNextStepperButton(stepperComponent: MdHorizontalStepper | MdVertic
288
284
expect ( stepperComponent . selectedIndex ) . toBe ( 2 ) ;
289
285
}
290
286
291
- function checkPreviousStepperButton ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
292
- fixture : ComponentFixture < any > ) {
287
+ function checkPreviousStepperButton ( stepperComponent : MdStepper , fixture : ComponentFixture < any > ) {
293
288
expect ( stepperComponent . selectedIndex ) . toBe ( 0 ) ;
294
289
295
290
stepperComponent . selectedIndex = 2 ;
@@ -315,8 +310,7 @@ function checkPreviousStepperButton(stepperComponent: MdHorizontalStepper | MdVe
315
310
expect ( stepperComponent . selectedIndex ) . toBe ( 0 ) ;
316
311
}
317
312
318
- function checkStepPosition ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
319
- fixture : ComponentFixture < any > ) {
313
+ function checkStepPosition ( stepperComponent : MdStepper , fixture : ComponentFixture < any > ) {
320
314
expect ( stepperComponent . _getAnimationDirection ( 0 ) ) . toBe ( 'current' ) ;
321
315
expect ( stepperComponent . _getAnimationDirection ( 1 ) ) . toBe ( 'next' ) ;
322
316
expect ( stepperComponent . _getAnimationDirection ( 2 ) ) . toBe ( 'next' ) ;
@@ -336,7 +330,7 @@ function checkStepPosition(stepperComponent: MdHorizontalStepper | MdVerticalSte
336
330
expect ( stepperComponent . _getAnimationDirection ( 2 ) ) . toBe ( 'current' ) ;
337
331
}
338
332
339
- function checkKeyboardEvent ( stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
333
+ function checkKeyboardEvent ( stepperComponent : MdStepper ,
340
334
fixture : ComponentFixture < any > ,
341
335
stepHeaders : DebugElement [ ] ) {
342
336
expect ( stepperComponent . _focusIndex ) . toBe ( 0 ) ;
@@ -395,7 +389,7 @@ function checkKeyboardEvent(stepperComponent: MdHorizontalStepper | MdVerticalSt
395
389
}
396
390
397
391
function checkLinearStepperValidity ( stepHeaderEl : HTMLElement ,
398
- stepperComponent : MdHorizontalStepper | MdVerticalStepper ,
392
+ stepperComponent : MdStepper ,
399
393
testComponent :
400
394
LinearMdHorizontalStepperApp | LinearMdVerticalStepperApp ,
401
395
fixture : ComponentFixture < any > ) {
@@ -458,9 +452,9 @@ class SimpleMdHorizontalStepperApp {
458
452
<md-step [stepControl]="oneGroup">
459
453
<form [formGroup]="oneGroup">
460
454
<ng-template mdStepLabel>Step one</ng-template>
461
- <md-input-container >
455
+ <md-form-field >
462
456
<input mdInput formControlName="oneCtrl" required>
463
- </md-input-container >
457
+ </md-form-field >
464
458
<div>
465
459
<button md-button mdStepperPrevious>Back</button>
466
460
<button md-button mdStepperNext>Next</button>
@@ -470,9 +464,9 @@ class SimpleMdHorizontalStepperApp {
470
464
<md-step [stepControl]="twoGroup">
471
465
<form [formGroup]="twoGroup">
472
466
<ng-template mdStepLabel>Step two</ng-template>
473
- <md-input-container >
467
+ <md-form-field >
474
468
<input mdInput formControlName="twoCtrl" required>
475
- </md-input-container >
469
+ </md-form-field >
476
470
<div>
477
471
<button md-button mdStepperPrevious>Back</button>
478
472
<button md-button mdStepperNext>Next</button>
@@ -535,9 +529,9 @@ class SimpleMdVerticalStepperApp {
535
529
<md-step [stepControl]="oneGroup">
536
530
<form [formGroup]="oneGroup">
537
531
<ng-template mdStepLabel>Step one</ng-template>
538
- <md-input-container >
532
+ <md-form-field >
539
533
<input mdInput formControlName="oneCtrl" required>
540
- </md-input-container >
534
+ </md-form-field >
541
535
<div>
542
536
<button md-button mdStepperPrevious>Back</button>
543
537
<button md-button mdStepperNext>Next</button>
@@ -547,9 +541,9 @@ class SimpleMdVerticalStepperApp {
547
541
<md-step [stepControl]="twoGroup">
548
542
<form [formGroup]="twoGroup">
549
543
<ng-template mdStepLabel>Step two</ng-template>
550
- <md-input-container >
544
+ <md-form-field >
551
545
<input mdInput formControlName="twoCtrl" required>
552
- </md-input-container >
546
+ </md-form-field >
553
547
<div>
554
548
<button md-button mdStepperPrevious>Back</button>
555
549
<button md-button mdStepperNext>Next</button>
0 commit comments