@@ -41,6 +41,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
41
41
spyOn ( grid . sortingDone , 'emit' ) . and . callThrough ( ) ;
42
42
const currentColumn = 'Name' ;
43
43
const lastNameColumn = 'LastName' ;
44
+ const nameHeaderCell = GridFunctions . getColumnHeader ( currentColumn , fixture ) ;
44
45
grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Asc , ignoreCase : false } ) ;
45
46
tick ( 30 ) ;
46
47
fixture . detectChanges ( ) ;
@@ -50,6 +51,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
50
51
sortingExpressions : grid . sortingExpressions ,
51
52
owner : grid
52
53
} ) ;
54
+ expect ( nameHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
53
55
54
56
expect ( grid . getCellByColumn ( 0 , currentColumn ) . value ) . toEqual ( 'ALex' ) ;
55
57
expect ( grid . getCellByColumn ( 0 , lastNameColumn ) . value ) . toEqual ( 'Smith' ) ;
@@ -72,13 +74,15 @@ describe('IgxGrid - Grid Sorting #grid', () => {
72
74
73
75
it ( 'Should sort grid descending by column name' , ( ) => {
74
76
const currentColumn = 'Name' ;
77
+ const nameHeaderCell = GridFunctions . getColumnHeader ( currentColumn , fixture ) ;
75
78
// Ignore case on sorting set to false
76
79
grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Desc , ignoreCase : false } ) ;
77
80
fixture . detectChanges ( ) ;
78
81
79
82
80
83
expect ( grid . getCellByColumn ( 0 , currentColumn ) . value ) . toEqual ( 'Rick' ) ;
81
84
expect ( grid . getCellByColumn ( grid . data . length - 1 , currentColumn ) . value ) . toEqual ( 'ALex' ) ;
85
+ expect ( nameHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'descending' ) ;
82
86
83
87
// Ignore case on sorting set to true
84
88
grid . sort ( { fieldName : currentColumn , dir : SortingDirection . Desc , ignoreCase : true } ) ;
@@ -476,6 +480,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
476
480
sortingExpressions : grid . sortingExpressions ,
477
481
owner : grid
478
482
} ) ;
483
+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
479
484
480
485
const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
481
486
const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
@@ -506,6 +511,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
506
511
sortingExpressions : grid . sortingExpressions ,
507
512
owner : grid
508
513
} ) ;
514
+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'ascending' ) ;
509
515
510
516
GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
511
517
tick ( 30 ) ;
@@ -516,6 +522,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
516
522
sortingExpressions : grid . sortingExpressions ,
517
523
owner : grid
518
524
} ) ;
525
+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( 'descending' ) ;
519
526
520
527
const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
521
528
const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
@@ -562,6 +569,7 @@ describe('IgxGrid - Grid Sorting #grid', () => {
562
569
expect ( GridFunctions . getColumnSortingIndex ( GridFunctions . getColumnHeader ( 'ID' , fixture ) ) ) . toBeNull ( ) ;
563
570
expect ( grid . sorting . emit ) . toHaveBeenCalledTimes ( 3 ) ;
564
571
expect ( grid . sortingDone . emit ) . toHaveBeenCalledTimes ( 3 ) ;
572
+ expect ( firstHeaderCell . attributes [ 'aria-sort' ] ) . toEqual ( undefined ) ;
565
573
} ) ) ;
566
574
567
575
it ( 'Should have a valid sorting icon when sorting using the API.' , ( ) => {
0 commit comments