@@ -145,6 +145,63 @@ describe('IgxGrid - multi-column headers #grid', () => {
145145
146146 } ) ) ;
147147
148+ it ( 'Should render a hidden row of the leaf column headers for accessibility purposes.' , fakeAsync ( ( ) => {
149+ fixture = TestBed . createComponent ( BlueWhaleGridComponent ) as ComponentFixture < BlueWhaleGridComponent > ;
150+ ( fixture as ComponentFixture < BlueWhaleGridComponent > ) . componentInstance . firstGroupRepeats = 0 ;
151+ ( fixture as ComponentFixture < BlueWhaleGridComponent > ) . componentInstance . secondGroupRepeats = 0 ;
152+ tick ( ) ;
153+ fixture . detectChanges ( ) ;
154+
155+ grid = fixture . componentInstance . grid ;
156+ const gridHeader = GridFunctions . getGridHeader ( grid ) ;
157+
158+ const groupHeaderEls = Array . from ( gridHeader . nativeElement . querySelectorAll ( '.' + GRID_COL_GROUP_THEAD_TITLE_CLASS ) ) ;
159+ for ( const header of groupHeaderEls ) {
160+ expect ( header . getAttribute ( 'aria-hidden' ) ) . toBe ( 'true' ) ;
161+ }
162+
163+ const columnHeaders = GridFunctions . getColumnHeaders ( fixture ) ;
164+ for ( const header of columnHeaders ) {
165+ expect ( header . nativeNode . getAttribute ( 'aria-hidden' ) ) . toBe ( 'true' ) ;
166+ }
167+
168+ const hiddenRow = gridHeader . nativeElement . querySelectorAll ( '[role="row"]' ) [ 1 ] ;
169+ const horizontalVirtualization = grid . rowList . first . virtDirRow ;
170+ const chunkSize = horizontalVirtualization . state . chunkSize ;
171+
172+ expect ( hiddenRow . children . length ) . toBeLessThanOrEqual ( chunkSize ) ;
173+ expect ( grid . columns . length ) . toBeGreaterThan ( chunkSize ) ;
174+
175+ expect ( hiddenRow . children [ 0 ] . textContent ) . toBe ( 'ID' ) ;
176+ expect ( hiddenRow . children [ 1 ] . textContent ) . toBe ( 'Company Name' ) ;
177+ expect ( hiddenRow . children [ 2 ] . textContent ) . toBe ( 'ContactName' ) ;
178+ expect ( hiddenRow . children [ 3 ] . textContent ) . toBe ( 'ContactTitle' ) ;
179+ expect ( hiddenRow . children [ 4 ] . textContent ) . toBe ( 'Country' ) ;
180+ expect ( hiddenRow . children [ 5 ] . textContent ) . toBe ( 'Region' ) ;
181+ expect ( hiddenRow . children [ 6 ] . textContent ) . toBe ( 'City' ) ;
182+ } ) ) ;
183+
184+ it ( 'The hidden row of the leaf columns contains only headers of the rendered cells' , fakeAsync ( ( ) => {
185+ fixture = TestBed . createComponent ( BlueWhaleGridComponent ) as ComponentFixture < BlueWhaleGridComponent > ;
186+ tick ( ) ;
187+ fixture . detectChanges ( ) ;
188+
189+ grid = fixture . componentInstance . grid ;
190+ const horizontalVirtualization = grid . rowList . first . virtDirRow ;
191+ const chunkSize = horizontalVirtualization . state . chunkSize ;
192+
193+ tick ( ) ;
194+ fixture . detectChanges ( ) ;
195+
196+ const gridHeader = GridFunctions . getGridHeader ( grid ) ;
197+ const hiddenRow = gridHeader . nativeElement . querySelectorAll ( '[role="row"]' ) [ 1 ] ;
198+
199+ expect ( hiddenRow . children . length ) . toBeLessThanOrEqual ( chunkSize ) ;
200+ for ( const ariaHeader of Array . from ( hiddenRow . children ) ) {
201+ expect ( ariaHeader . textContent ) . toBe ( 'ID' ) ;
202+ }
203+ } ) ) ;
204+
148205 it ( 'Should render dynamic column group header correctly (#12165).' , ( ) => {
149206 fixture = TestBed . createComponent ( BlueWhaleGridComponent ) as ComponentFixture < BlueWhaleGridComponent > ;
150207 ( fixture as ComponentFixture < BlueWhaleGridComponent > ) . componentInstance . firstGroupRepeats = 1 ;
0 commit comments