@@ -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 } ) }
@@ -146,6 +147,41 @@ describe('MatHorizontalStepper', () => {
146147 } ) ;
147148 } ) ;
148149
150+ describe ( 'icon overrides' , ( ) => {
151+ let fixture : ComponentFixture < IconOverridesStepper > ;
152+
153+ beforeEach ( ( ) => {
154+ fixture = TestBed . createComponent ( IconOverridesStepper ) ;
155+ fixture . detectChanges ( ) ;
156+ } ) ;
157+
158+ it ( 'should allow for the `edit` icon to be overridden' , ( ) => {
159+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ;
160+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
161+
162+ stepperComponent . _steps . toArray ( ) [ 0 ] . editable = true ;
163+ stepperComponent . next ( ) ;
164+ fixture . detectChanges ( ) ;
165+
166+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
167+
168+ expect ( header . textContent ) . toContain ( 'Custom edit' ) ;
169+ } ) ;
170+
171+ it ( 'should allow for the `done` icon to be overridden' , ( ) => {
172+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ;
173+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
174+
175+ stepperComponent . _steps . toArray ( ) [ 0 ] . editable = false ;
176+ stepperComponent . next ( ) ;
177+ fixture . detectChanges ( ) ;
178+
179+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
180+
181+ expect ( header . textContent ) . toContain ( 'Custom done' ) ;
182+ } ) ;
183+ } ) ;
184+
149185 describe ( 'linear horizontal stepper' , ( ) => {
150186 let fixture : ComponentFixture < LinearMatHorizontalStepperApp > ;
151187 let testComponent : LinearMatHorizontalStepperApp ;
@@ -1083,3 +1119,17 @@ class SimpleStepperWithStepControlAndCompletedBinding {
10831119 { label : 'Three' , completed : false , control : new FormControl ( ) }
10841120 ] ;
10851121}
1122+
1123+ @Component ( {
1124+ template : `
1125+ <mat-horizontal-stepper>
1126+ <ng-template matStepperIcon="edit">Custom edit</ng-template>
1127+ <ng-template matStepperIcon="done">Custom done</ng-template>
1128+
1129+ <mat-step>Content 1</mat-step>
1130+ <mat-step>Content 2</mat-step>
1131+ <mat-step>Content 3</mat-step>
1132+ </mat-horizontal-stepper>
1133+ `
1134+ } )
1135+ class IconOverridesStepper { }
0 commit comments