@@ -41,6 +41,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
4141 spyOn ( grid . sortingDone , 'emit' ) . and . callThrough ( ) ;
4242 const currentColumn = 'Name' ;
4343 const lastNameColumn = 'LastName' ;
44+ const nameHeaderCell = GridFunctions . getColumnHeader ( currentColumn , fixture ) ;
4445 grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Asc , ignoreCase : false } ) ;
4546 tick ( 30 ) ;
4647 fixture . detectChanges ( ) ;
@@ -50,6 +51,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
5051 sortingExpressions : grid . sortingExpressions ,
5152 owner : grid
5253 } ) ;
54+ expect ( nameHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
5355
5456 expect ( grid . getCellByColumn ( 0 , currentColumn ) . value ) . toEqual ( 'ALex' ) ;
5557 expect ( grid . getCellByColumn ( 0 , lastNameColumn ) . value ) . toEqual ( 'Smith' ) ;
@@ -72,13 +74,15 @@ describe('IgxGrid - Grid Sorting #grid', () => {
7274
7375 it ( 'Should sort grid descending by column name' , ( ) => {
7476 const currentColumn = 'Name' ;
77+ const nameHeaderCell = GridFunctions . getColumnHeader ( currentColumn , fixture ) ;
7578 // Ignore case on sorting set to false
7679 grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Desc , ignoreCase : false } ) ;
7780 fixture . detectChanges ( ) ;
7881
7982
8083 expect ( grid . getCellByColumn ( 0 , currentColumn ) . value ) . toEqual ( 'Rick' ) ;
8184 expect ( grid . getCellByColumn ( grid . data . length - 1 , currentColumn ) . value ) . toEqual ( 'ALex' ) ;
85+ expect ( nameHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'descending' ) ;
8286
8387 // Ignore case on sorting set to true
8488 grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Desc , ignoreCase : true } ) ;
@@ -476,6 +480,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
476480 sortingExpressions : grid . sortingExpressions ,
477481 owner : grid
478482 } ) ;
483+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
479484
480485 const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
481486 const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
@@ -506,6 +511,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
506511 sortingExpressions : grid . sortingExpressions ,
507512 owner : grid
508513 } ) ;
514+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
509515
510516 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
511517 tick ( 30 ) ;
@@ -516,6 +522,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
516522 sortingExpressions : grid . sortingExpressions ,
517523 owner : grid
518524 } ) ;
525+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'descending' ) ;
519526
520527 const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
521528 const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
@@ -562,6 +569,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
562569 expect ( GridFunctions . getColumnSortingIndex ( GridFunctions . getColumnHeader ( 'ID' , fixture ) ) ) . toBeNull ( ) ;
563570 expect ( grid . sorting . emit ) . toHaveBeenCalledTimes ( 3 ) ;
564571 expect ( grid . sortingDone . emit ) . toHaveBeenCalledTimes ( 3 ) ;
572+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( undefined ) ;
565573 } ) ) ;
566574
567575 it ( 'Should have a valid sorting icon when sorting using the API.' , ( ) => {
0 commit comments