@@ -114,25 +114,20 @@ describe('MatStepper', () => {
114
114
expect ( stepper . selected instanceof MatStep ) . toBe ( true ) ;
115
115
} ) ;
116
116
117
- it ( 'should set the "tablist" role on stepper' , ( ) => {
118
- const stepperEl = fixture . debugElement . query ( By . css ( 'mat-stepper' ) ) ! . nativeElement ;
119
- expect ( stepperEl . getAttribute ( 'role' ) ) . toBe ( 'tablist' ) ;
120
- } ) ;
121
-
122
117
it ( 'should display the correct label' , ( ) => {
123
- let selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
118
+ let selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
124
119
expect ( selectedLabel . textContent ) . toMatch ( 'Step 1' ) ;
125
120
126
121
fixture . componentInstance . stepper . selectedIndex = 2 ;
127
122
fixture . detectChanges ( ) ;
128
123
129
- selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
124
+ selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
130
125
expect ( selectedLabel . textContent ) . toMatch ( 'Step 3' ) ;
131
126
132
127
fixture . componentInstance . inputLabel . set ( 'New Label' ) ;
133
128
fixture . detectChanges ( ) ;
134
129
135
- selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
130
+ selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
136
131
expect ( selectedLabel . textContent ) . toMatch ( 'New Label' ) ;
137
132
} ) ;
138
133
@@ -342,15 +337,6 @@ describe('MatStepper', () => {
342
337
animationDoneSubscription . unsubscribe ( ) ;
343
338
} ) ;
344
339
345
- it ( 'should set the correct aria-posinset and aria-setsize' , ( ) => {
346
- const headers = Array . from < HTMLElement > (
347
- fixture . nativeElement . querySelectorAll ( '.mat-step-header' ) ,
348
- ) ;
349
-
350
- expect ( headers . map ( header => header . getAttribute ( 'aria-posinset' ) ) ) . toEqual ( [ '1' , '2' , '3' ] ) ;
351
- expect ( headers . every ( header => header . getAttribute ( 'aria-setsize' ) === '3' ) ) . toBe ( true ) ;
352
- } ) ;
353
-
354
340
it ( 'should adjust the index when removing a step before the current one' , ( ) => {
355
341
const stepper = fixture . componentInstance . stepper ;
356
342
@@ -937,14 +923,6 @@ describe('MatStepper', () => {
937
923
} ) ;
938
924
939
925
describe ( 'vertical stepper' , ( ) => {
940
- it ( 'should set the aria-orientation to "vertical"' , ( ) => {
941
- const fixture = createComponent ( SimpleMatVerticalStepperApp ) ;
942
- fixture . detectChanges ( ) ;
943
-
944
- const stepperEl = fixture . debugElement . query ( By . css ( 'mat-stepper' ) ) ! . nativeElement ;
945
- expect ( stepperEl . getAttribute ( 'aria-orientation' ) ) . toBe ( 'vertical' ) ;
946
- } ) ;
947
-
948
926
it ( 'should support using the left/right arrows to move focus' , ( ) => {
949
927
const fixture = createComponent ( SimpleMatVerticalStepperApp ) ;
950
928
fixture . detectChanges ( ) ;
@@ -1045,7 +1023,7 @@ describe('MatStepper', () => {
1045
1023
const fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
1046
1024
fixture . detectChanges ( ) ;
1047
1025
1048
- const stepperEl = fixture . debugElement . query ( By . css ( 'mat-stepper ' ) ) ! . nativeElement ;
1026
+ const stepperEl = fixture . debugElement . query ( By . css ( '[role="tablist"] ' ) ) ! . nativeElement ;
1049
1027
expect ( stepperEl . getAttribute ( 'aria-orientation' ) ) . toBe ( 'horizontal' ) ;
1050
1028
} ) ;
1051
1029
@@ -1066,6 +1044,18 @@ describe('MatStepper', () => {
1066
1044
assertArrowKeyInteractionInRtl ( fixture , stepHeaders ) ;
1067
1045
} ) ;
1068
1046
1047
+ it ( 'should set the correct aria-posinset and aria-setsize' , ( ) => {
1048
+ const fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
1049
+ fixture . detectChanges ( ) ;
1050
+
1051
+ const headers = Array . from < HTMLElement > (
1052
+ fixture . nativeElement . querySelectorAll ( '.mat-step-header' ) ,
1053
+ ) ;
1054
+
1055
+ expect ( headers . map ( header => header . getAttribute ( 'aria-posinset' ) ) ) . toEqual ( [ '1' , '2' , '3' ] ) ;
1056
+ expect ( headers . every ( header => header . getAttribute ( 'aria-setsize' ) === '3' ) ) . toBe ( true ) ;
1057
+ } ) ;
1058
+
1069
1059
it ( 'should maintain the correct navigation order when a step is added later on' , ( ) => {
1070
1060
const fixture = createComponent ( HorizontalStepperWithDelayedStep ) ;
1071
1061
fixture . detectChanges ( ) ;
0 commit comments