@@ -7,7 +7,9 @@ test.describe("playground accessibility", () => {
77 test . beforeEach ( async ( { page } , testInfo ) => {
88 test . skip ( testInfo . project . name !== "chromium" , "Playground accessibility scans run once." ) ;
99 await page . goto ( playgroundUrl ) ;
10- await page . waitForFunction ( ( ) => document . querySelector ( '[role="dialog"][aria-label="Settings"]' ) ) ;
10+ await page . waitForFunction ( ( ) =>
11+ document . querySelector ( '[role="dialog"][aria-label="Settings"]' )
12+ ) ;
1113 } ) ;
1214
1315 test ( "has no automatically detectable axe violations" , async ( { page } ) => {
@@ -16,31 +18,37 @@ test.describe("playground accessibility", () => {
1618 } ) ;
1719
1820 test ( "has named controls and valid aria-controls references" , async ( { page } ) => {
19- const unnamed = await page . locator ( "a[href], button, input, [role='button']" ) . evaluateAll ( ( els ) =>
20- els
21- . filter ( ( el ) => {
22- const style = getComputedStyle ( el ) ;
23- return style . display !== "none" && el . getAttribute ( "aria-hidden" ) !== "true" ;
24- } )
25- . filter ( ( el ) => {
26- if ( el . getAttribute ( "aria-label" ) ) return false ;
27- if ( el instanceof HTMLInputElement && el . labels && el . labels . length > 0 ) return false ;
28- return ( el . textContent ?? "" ) . trim ( ) === "" ;
29- } )
30- . map ( ( el ) => el . outerHTML )
31- ) ;
21+ const unnamed = await page
22+ . locator ( "a[href], button, input, [role='button']" )
23+ . evaluateAll ( ( els ) =>
24+ els
25+ . filter ( ( el ) => {
26+ const style = getComputedStyle ( el ) ;
27+ return style . display !== "none" && el . getAttribute ( "aria-hidden" ) !== "true" ;
28+ } )
29+ . filter ( ( el ) => {
30+ if ( el . getAttribute ( "aria-label" ) ) return false ;
31+ if ( el instanceof HTMLInputElement && el . labels && el . labels . length > 0 ) return false ;
32+ return ( el . textContent ?? "" ) . trim ( ) === "" ;
33+ } )
34+ . map ( ( el ) => el . outerHTML )
35+ ) ;
3236 expect ( unnamed ) . toEqual ( [ ] ) ;
3337
34- const brokenControls = await page . locator ( "[aria-controls]" ) . evaluateAll ( ( els ) =>
35- els
36- . map ( ( el ) => el . getAttribute ( "aria-controls" ) )
37- . filter ( ( id ) : id is string => id !== null && document . getElementById ( id ) === null )
38- ) ;
38+ const brokenControls = await page
39+ . locator ( "[aria-controls]" )
40+ . evaluateAll ( ( els ) =>
41+ els
42+ . map ( ( el ) => el . getAttribute ( "aria-controls" ) )
43+ . filter ( ( id ) : id is string => id !== null && document . getElementById ( id ) === null )
44+ ) ;
3945 expect ( brokenControls ) . toEqual ( [ ] ) ;
4046 } ) ;
4147
4248 test ( "announces generated docs links that open a new tab" , async ( { page } ) => {
43- await page . locator ( '[role="button"][aria-label="Docs"][aria-controls="bubble-panel-docs"]' ) . click ( ) ;
49+ await page
50+ . locator ( '[role="button"][aria-label="Docs"][aria-controls="bubble-panel-docs"]' )
51+ . click ( ) ;
4452 const externalLinks = page . locator ( "[role='dialog'][aria-label='Docs'] a[target='_blank']" ) ;
4553 await expect ( externalLinks . first ( ) ) . toContainText ( "opens in new tab" ) ;
4654 } ) ;
0 commit comments