@@ -3,16 +3,9 @@ import { module, test } from 'qunit';
33import { setupApplicationTest } from 'ember-qunit' ;
44
55import { colorScheme } from 'ember-primitives/color-scheme' ;
6+ import { docsManager } from 'kolay' ;
67
7- // import { a11yAudit } from 'ember-a11y-testing/test-support';
8-
9- async function a11yAudit ( _options : any ) {
10- await Promise . resolve ( ) ;
11- console . debug ( `a11y audit disabled until ember-a11y-testing supports native vite apps` ) ;
12- }
13-
14- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
15- const pages : { path : string } [ ] = ( window as any ) . __pages__ ;
8+ import { a11yAudit } from 'ember-a11y-testing/test-support' ;
169
1710/**
1811 * per-page settings
@@ -71,8 +64,7 @@ async function checkA11y(assert: Assert, path: string, theme: string, settings:
7164 }
7265 }
7366
74- const message =
75- `no a11y errors found for ${ path } using the ${ theme } theme` + `\n\n` + errorText ;
67+ const message = `${ path } : no a11y errors found using the ${ theme } theme` + `\n\n` + errorText ;
7668
7769 if ( window . location . search . includes ( 'debugA11yAudit' ) ) {
7870 console . error ( errorText ) ;
@@ -85,22 +77,39 @@ async function checkA11y(assert: Assert, path: string, theme: string, settings:
8577module ( 'Application | Pages' , function ( hooks ) {
8678 setupApplicationTest ( hooks ) ;
8779
88- for ( const page of pages ) {
89- test ( `${ page . path } ` , async function ( assert ) {
90- const path = page . path . replace ( '.md' , '' ) ;
80+ test ( 'Pages all fit a11y criteria' , async function ( assert ) {
81+ await visit ( '/' ) ;
82+
83+ const pages : { path : string } [ ] = [ ] ;
84+
85+ const docsService = docsManager ( this ) ;
86+ const groups = docsService . manifest . groups ;
87+
88+ for ( const group of groups ) {
89+ for ( const page of group . list ) {
90+ pages . push ( page ) ;
91+ }
92+ }
93+
94+ assert . ok ( pages . length > 10 , `There are at least a few pages` ) ;
95+
96+ for ( const page of pages ) {
97+ const path = page . path . replace ( '.gjs.md' , '' ) . replace ( '.md' , '' ) ;
9198 const settings : object = a11yChecks [ page . path ] ?? { } ;
9299
93100 await visit ( path ) ;
94101 await waitUntil ( ( ) => findAll ( 'nav a' ) . length !== 0 ) ;
95102 await checkA11y ( assert , path , 'default' , settings ) ;
96103
97- assert . dom ( '[data-page-error]' ) . doesNotExist ( ) ;
104+ assert
105+ . dom ( '[data-page-error]' )
106+ . doesNotExist ( `${ page . path } : does not contain [data-page-error]` ) ;
98107
99108 colorScheme . update ( 'dark' ) ;
100109 await checkA11y ( assert , path , 'dark' , settings ) ;
101110
102111 colorScheme . update ( 'light' ) ;
103112 await checkA11y ( assert , path , 'light' , settings ) ;
104- } ) ;
105- }
113+ }
114+ } ) ;
106115} ) ;
0 commit comments