@@ -30,7 +30,8 @@ describe('MatHorizontalStepper', () => {
3030 SimplePreselectedMatHorizontalStepperApp ,
3131 LinearMatHorizontalStepperApp ,
3232 SimpleStepperWithoutStepControl ,
33- SimpleStepperWithStepControlAndCompletedBinding
33+ SimpleStepperWithStepControlAndCompletedBinding ,
34+ IconOverridesStepper ,
3435 ] ,
3536 providers : [
3637 { provide : Directionality , useFactory : ( ) => ( { value : dir } ) }
@@ -174,6 +175,41 @@ describe('MatHorizontalStepper', () => {
174175 } ) ;
175176 } ) ;
176177
178+ describe ( 'icon overrides' , ( ) => {
179+ let fixture : ComponentFixture < IconOverridesStepper > ;
180+
181+ beforeEach ( ( ) => {
182+ fixture = TestBed . createComponent ( IconOverridesStepper ) ;
183+ fixture . detectChanges ( ) ;
184+ } ) ;
185+
186+ it ( 'should allow for the `edit` icon to be overridden' , ( ) => {
187+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ;
188+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
189+
190+ stepperComponent . _steps . toArray ( ) [ 0 ] . editable = true ;
191+ stepperComponent . next ( ) ;
192+ fixture . detectChanges ( ) ;
193+
194+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
195+
196+ expect ( header . textContent ) . toContain ( 'Custom edit' ) ;
197+ } ) ;
198+
199+ it ( 'should allow for the `done` icon to be overridden' , ( ) => {
200+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ;
201+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
202+
203+ stepperComponent . _steps . toArray ( ) [ 0 ] . editable = false ;
204+ stepperComponent . next ( ) ;
205+ fixture . detectChanges ( ) ;
206+
207+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
208+
209+ expect ( header . textContent ) . toContain ( 'Custom done' ) ;
210+ } ) ;
211+ } ) ;
212+
177213 describe ( 'linear horizontal stepper' , ( ) => {
178214 let fixture : ComponentFixture < LinearMatHorizontalStepperApp > ;
179215 let testComponent : LinearMatHorizontalStepperApp ;
@@ -1168,3 +1204,17 @@ class SimpleStepperWithStepControlAndCompletedBinding {
11681204 { label : 'Three' , completed : false , control : new FormControl ( ) }
11691205 ] ;
11701206}
1207+
1208+ @Component ( {
1209+ template : `
1210+ <mat-horizontal-stepper>
1211+ <ng-template matStepperIcon="edit">Custom edit</ng-template>
1212+ <ng-template matStepperIcon="done">Custom done</ng-template>
1213+
1214+ <mat-step>Content 1</mat-step>
1215+ <mat-step>Content 2</mat-step>
1216+ <mat-step>Content 3</mat-step>
1217+ </mat-horizontal-stepper>
1218+ `
1219+ } )
1220+ class IconOverridesStepper { }
0 commit comments