@@ -3,7 +3,7 @@ import { expect } from '@playwright/test';
33import { configs , test } from '@utils/test/playwright' ;
44
55configs ( { directions : [ 'ltr' ] , palettes : [ 'light' , 'dark' ] } ) . forEach ( ( { title, config } ) => {
6- test . describe ( title ( 'textarea : a11y' ) , ( ) => {
6+ test . describe ( title ( 'select : a11y' ) , ( ) => {
77 test ( 'default layout should not have accessibility violations' , async ( { page } ) => {
88 await page . setContent (
99 `
@@ -111,3 +111,39 @@ configs({ directions: ['ltr'] }).forEach(({ title, config, screenshot }) => {
111111 } ) ;
112112 } ) ;
113113} ) ;
114+
115+ /**
116+ * This behavior does not vary across modes/directions.
117+ */
118+ configs ( { modes : [ 'ios' ] , directions : [ 'ltr' ] } ) . forEach ( ( { title, config } ) => {
119+ test . describe ( title ( 'select: aria attributes' ) , ( ) => {
120+ test ( 'should have a aria-description on the selected option when action sheet interface is open' , async ( {
121+ page,
122+ } ) => {
123+ await page . setContent (
124+ `
125+ <ion-select label="Fruit" value="apple" interface="action-sheet">
126+ <ion-select-option value="apple">Apple</ion-select-option>
127+ <ion-select-option value="banana">Banana</ion-select-option>
128+ <ion-select-option value="orange">Orange</ion-select-option>
129+ </ion-select>
130+ ` ,
131+ config
132+ ) ;
133+
134+ const ionActionSheetDidPresent = await page . spyOnEvent ( 'ionActionSheetDidPresent' ) ;
135+
136+ const select = page . locator ( 'ion-select' ) ;
137+
138+ await select . click ( ) ;
139+ await ionActionSheetDidPresent . next ( ) ;
140+
141+ const selectedOption = page . locator ( '.action-sheet-selected' ) ;
142+ await expect ( selectedOption ) . toHaveAttribute ( 'aria-description' , 'selected' ) ;
143+
144+ // Check that the attribut is not added to non-selected option
145+ const nonSelectedOption = page . locator ( '.select-interface-option:not(.action-sheet-selected)' ) . first ( ) ;
146+ await expect ( nonSelectedOption ) . not . toHaveAttribute ( 'aria-description' ) ;
147+ } ) ;
148+ } ) ;
149+ } ) ;
0 commit comments