@@ -476,6 +476,68 @@ describe('MatStepper', () => {
476
476
} ) ) ;
477
477
} ) ;
478
478
479
+ describe ( 'basic stepper with completed label change' , ( ) => {
480
+ let fixture : ComponentFixture < SimpleMatHorizontalStepperApp > ;
481
+
482
+ beforeEach ( ( ) => {
483
+ fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
484
+ fixture . detectChanges ( ) ;
485
+ } ) ;
486
+
487
+ it ( 'should re-render when the completed labels change' , inject ( [ MatStepperIntl ] ,
488
+ ( intl : MatStepperIntl ) => {
489
+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ! ;
490
+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
491
+
492
+ stepperComponent . steps . toArray ( ) [ 0 ] . editable = false ;
493
+ stepperComponent . next ( ) ;
494
+ fixture . detectChanges ( ) ;
495
+
496
+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
497
+ const completedLabel = header . querySelector ( '.cdk-visually-hidden' ) ;
498
+
499
+ expect ( completedLabel ) . toBeTruthy ( ) ;
500
+ expect ( completedLabel . textContent ) . toBe ( 'Completed' ) ;
501
+
502
+ intl . completedLabel = 'Completada' ;
503
+ intl . changes . next ( ) ;
504
+ fixture . detectChanges ( ) ;
505
+
506
+ expect ( completedLabel . textContent ) . toBe ( 'Completada' ) ;
507
+ } ) ) ;
508
+ } ) ;
509
+
510
+ describe ( 'basic stepper with editable label change' , ( ) => {
511
+ let fixture : ComponentFixture < SimpleMatHorizontalStepperApp > ;
512
+
513
+ beforeEach ( ( ) => {
514
+ fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
515
+ fixture . detectChanges ( ) ;
516
+ } ) ;
517
+
518
+ it ( 'should re-render when the editable label changes' , inject ( [ MatStepperIntl ] ,
519
+ ( intl : MatStepperIntl ) => {
520
+ const stepperDebugElement = fixture . debugElement . query ( By . directive ( MatStepper ) ) ! ;
521
+ const stepperComponent : MatStepper = stepperDebugElement . componentInstance ;
522
+
523
+ stepperComponent . steps . toArray ( ) [ 0 ] . editable = true ;
524
+ stepperComponent . next ( ) ;
525
+ fixture . detectChanges ( ) ;
526
+
527
+ const header = stepperDebugElement . nativeElement . querySelector ( 'mat-step-header' ) ;
528
+ const editableLabel = header . querySelector ( '.cdk-visually-hidden' ) ;
529
+
530
+ expect ( editableLabel ) . toBeTruthy ( ) ;
531
+ expect ( editableLabel . textContent ) . toBe ( 'Editable' ) ;
532
+
533
+ intl . editableLabel = 'Modificabile' ;
534
+ intl . changes . next ( ) ;
535
+ fixture . detectChanges ( ) ;
536
+
537
+ expect ( editableLabel . textContent ) . toBe ( 'Modificabile' ) ;
538
+ } ) ) ;
539
+ } ) ;
540
+
479
541
describe ( 'icon overrides' , ( ) => {
480
542
let fixture : ComponentFixture < IconOverridesStepper > ;
481
543
0 commit comments