@@ -79,7 +79,8 @@ describe('Rendering Tests', () => {
79
79
waitForAsync ( ( ) => {
80
80
TestBed . configureTestingModule ( {
81
81
declarations : [
82
- IgxStepperSampleTestComponent
82
+ IgxStepperSampleTestComponent ,
83
+ IgxStepperLinearComponent
83
84
] ,
84
85
imports : [
85
86
NoopAnimationsModule ,
@@ -148,6 +149,22 @@ describe('Rendering Tests', () => {
148
149
expect ( serviceCollapseSpy ) . toHaveBeenCalledOnceWith ( stepper . steps [ 0 ] ) ;
149
150
} ) ) ;
150
151
152
+ it ( 'should calculate disabled steps properly when the stepper is initially in linear mode' , fakeAsync ( ( ) => {
153
+ const fixture = TestBed . createComponent ( IgxStepperLinearComponent ) ;
154
+ fixture . detectChanges ( ) ;
155
+ const linearStepper = fixture . componentInstance . stepper ;
156
+
157
+ const serviceExpandSpy = spyOn ( ( linearStepper as any ) . stepperService , 'expand' ) . and . callThrough ( ) ;
158
+ linearStepper . next ( ) ;
159
+ fixture . detectChanges ( ) ;
160
+ tick ( ) ;
161
+
162
+ expect ( linearStepper . steps [ 1 ] . active ) . toBeFalsy ( ) ;
163
+ expect ( linearStepper . steps [ 0 ] . active ) . toBeTruthy ( ) ;
164
+ expect ( linearStepper . steps [ 1 ] . linearDisabled ) . toBeTruthy ( ) ;
165
+ expect ( serviceExpandSpy ) . not . toHaveBeenCalled ( ) ;
166
+ } ) ) ;
167
+
151
168
it ( 'should not allow moving forward to next step in linear mode if the previous step is invalid' , fakeAsync ( ( ) => {
152
169
const serviceExpandSpy = spyOn ( ( stepper as any ) . stepperService , 'expand' ) . and . callThrough ( ) ;
153
170
stepper . orientation = IgxStepperOrientation . Horizontal ;
@@ -1292,3 +1309,21 @@ export class IgxStepperSampleTestComponent {
1292
1309
public displayHiddenStep = false ;
1293
1310
1294
1311
}
1312
+
1313
+ @Component ( {
1314
+ template : `
1315
+ <igx-stepper #stepper [linear]="true">
1316
+ <igx-step #step1 [isValid]="false">
1317
+ </igx-step>
1318
+
1319
+ <igx-step #step2 [isValid]="false">
1320
+ </igx-step>
1321
+
1322
+ <igx-step #step3 [isValid]="false">
1323
+ </igx-step>
1324
+ </igx-stepper>
1325
+ `
1326
+ } )
1327
+ export class IgxStepperLinearComponent {
1328
+ @ViewChild ( IgxStepperComponent ) public stepper : IgxStepperComponent ;
1329
+ }
0 commit comments