@@ -21,7 +21,7 @@ import { FilteringLogic } from '../../data-operations/filtering-expression.inter
2121import { IgxTabContentComponent , IgxTabHeaderComponent , IgxTabItemComponent , IgxTabsComponent } from '../../tabs/tabs/public_api' ;
2222import { IgxGridRowComponent } from './grid-row.component' ;
2323import { ISortingExpression , SortingDirection } from '../../data-operations/sorting-strategy' ;
24- import { GRID_SCROLL_CLASS } from '../../test-utils/grid-functions.spec' ;
24+ import { GRID_SCROLL_CLASS , GridFunctions } from '../../test-utils/grid-functions.spec' ;
2525import { AsyncPipe } from '@angular/common' ;
2626import { IgxPaginatorComponent , IgxPaginatorContentDirective } from '../../paginator/paginator.component' ;
2727import { IGridRowEventArgs , IgxColumnGroupComponent , IgxGridEmptyTemplateDirective , IgxGridFooterComponent , IgxGridLoadingTemplateDirective , IgxGridRow , IgxGroupByRow , IgxSummaryRow } from '../public_api' ;
@@ -2017,26 +2017,31 @@ describe('IgxGrid Component Tests #grid', () => {
20172017 expect ( grid . columns [ 2 ] . field ) . toBe ( 'lastName' ) ;
20182018 } ) ) ;
20192019
2020- it ( 'should specify the correct aria-rowindex and aria-colindex attributes for cells ' , async ( ) => {
2020+ it ( 'should set correct aria attributes related to total rows/cols count and indexes ' , async ( ) => {
20212021 const fix = TestBed . createComponent ( IgxGridDefaultRenderingComponent ) ;
20222022 fix . componentInstance . initColumnsRows ( 80 , 20 ) ;
20232023 fix . detectChanges ( ) ;
20242024 fix . detectChanges ( ) ;
20252025
20262026 const grid = fix . componentInstance . grid ;
2027+ const gridHeader = GridFunctions . getGridHeader ( grid ) ;
2028+ const headerRowElement = gridHeader . nativeElement . querySelector ( '[role="row"]' ) ;
20272029
20282030 grid . navigateTo ( 50 , 16 ) ;
20292031 fix . detectChanges ( ) ;
20302032 await wait ( ) ;
20312033 fix . detectChanges ( ) ;
20322034
2035+ expect ( headerRowElement . getAttribute ( 'aria-rowindex' ) ) . toBe ( '1' ) ;
2036+ expect ( grid . nativeElement . getAttribute ( 'aria-rowcount' ) ) . toBe ( '81' ) ;
2037+ expect ( grid . nativeElement . getAttribute ( 'aria-colcount' ) ) . toBe ( '20' ) ;
2038+
20332039 const cell = grid . gridAPI . get_cell_by_index ( 50 , 'col16' ) ;
20342040 // The following attributes indicate to assistive technologies which portions
20352041 // of the content are displayed in case not all are rendered,
20362042 // such as with the built-in virtualization of the grid. 1-based index.
2037- expect ( cell . nativeElement . getAttribute ( 'aria-rowindex' ) ) . toBe ( '51 ' ) ;
2043+ expect ( cell . nativeElement . getAttribute ( 'aria-rowindex' ) ) . toBe ( '52 ' ) ;
20382044 expect ( cell . nativeElement . getAttribute ( 'aria-colindex' ) ) . toBe ( '17' ) ;
2039-
20402045 } ) ;
20412046 } ) ;
20422047
0 commit comments