@@ -114,25 +114,20 @@ describe('MatStepper', () => {
114114 expect ( stepper . selected instanceof MatStep ) . toBe ( true ) ;
115115 } ) ;
116116
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-
122117 it ( 'should display the correct label' , ( ) => {
123- let selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
118+ let selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
124119 expect ( selectedLabel . textContent ) . toMatch ( 'Step 1' ) ;
125120
126121 fixture . componentInstance . stepper . selectedIndex = 2 ;
127122 fixture . detectChanges ( ) ;
128123
129- selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
124+ selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
130125 expect ( selectedLabel . textContent ) . toMatch ( 'Step 3' ) ;
131126
132127 fixture . componentInstance . inputLabel . set ( 'New Label' ) ;
133128 fixture . detectChanges ( ) ;
134129
135- selectedLabel = fixture . nativeElement . querySelector ( '[aria-selected="true "]' ) ;
130+ selectedLabel = fixture . nativeElement . querySelector ( '[aria-current="step "]' ) ;
136131 expect ( selectedLabel . textContent ) . toMatch ( 'New Label' ) ;
137132 } ) ;
138133
@@ -342,15 +337,6 @@ describe('MatStepper', () => {
342337 animationDoneSubscription . unsubscribe ( ) ;
343338 } ) ;
344339
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-
354340 it ( 'should adjust the index when removing a step before the current one' , ( ) => {
355341 const stepper = fixture . componentInstance . stepper ;
356342
@@ -937,14 +923,6 @@ describe('MatStepper', () => {
937923 } ) ;
938924
939925 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-
948926 it ( 'should support using the left/right arrows to move focus' , ( ) => {
949927 const fixture = createComponent ( SimpleMatVerticalStepperApp ) ;
950928 fixture . detectChanges ( ) ;
@@ -1045,7 +1023,7 @@ describe('MatStepper', () => {
10451023 const fixture = createComponent ( SimpleMatHorizontalStepperApp ) ;
10461024 fixture . detectChanges ( ) ;
10471025
1048- const stepperEl = fixture . debugElement . query ( By . css ( 'mat-stepper ' ) ) ! . nativeElement ;
1026+ const stepperEl = fixture . debugElement . query ( By . css ( '[role="tablist"] ' ) ) ! . nativeElement ;
10491027 expect ( stepperEl . getAttribute ( 'aria-orientation' ) ) . toBe ( 'horizontal' ) ;
10501028 } ) ;
10511029
@@ -1066,6 +1044,18 @@ describe('MatStepper', () => {
10661044 assertArrowKeyInteractionInRtl ( fixture , stepHeaders ) ;
10671045 } ) ;
10681046
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+
10691059 it ( 'should maintain the correct navigation order when a step is added later on' , ( ) => {
10701060 const fixture = createComponent ( HorizontalStepperWithDelayedStep ) ;
10711061 fixture . detectChanges ( ) ;
0 commit comments