@@ -89,6 +89,36 @@ describe('ui.grid.expandable', function() {
89
89
expect ( element . find ( '.test' ) . length ) . toBe ( 1 ) ;
90
90
} ) ;
91
91
} ) ;
92
+
93
+ it ( 'expand row icon should set the accessibility property aria-expanded' , function ( ) {
94
+ scope . gridOptions . data . push ( { col1 : 'row2col1' , col2 : 'row2col2' } ) ;
95
+ scope . $apply ( ) ;
96
+
97
+ var expandAllButton = element . find ( '.ui-grid-icon-button' ) ;
98
+ var expandRowIcons = element . find ( '.ui-grid-viewport .ui-grid-expandable-buttons-cell .clickable' ) ;
99
+
100
+ expect ( expandAllButton . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
101
+ expect ( expandRowIcons . eq ( 0 ) . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
102
+ expect ( expandRowIcons . eq ( 1 ) . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
103
+
104
+ scope . gridApi . expandable . toggleRowExpansion ( scope . grid . rows [ 0 ] . entity ) ;
105
+ scope . $apply ( ) ;
106
+ expect ( expandAllButton . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
107
+ expect ( expandRowIcons . eq ( 0 ) . attr ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
108
+ expect ( expandRowIcons . eq ( 1 ) . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
109
+
110
+ scope . gridApi . expandable . toggleRowExpansion ( scope . grid . rows [ 1 ] . entity ) ;
111
+ scope . $apply ( ) ;
112
+ expect ( expandAllButton . attr ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
113
+ expect ( expandRowIcons . eq ( 0 ) . attr ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
114
+ expect ( expandRowIcons . eq ( 1 ) . attr ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
115
+
116
+ scope . gridApi . expandable . toggleAllRows ( ) ;
117
+ scope . $apply ( ) ;
118
+ expect ( expandAllButton . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
119
+ expect ( expandRowIcons . eq ( 0 ) . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
120
+ expect ( expandRowIcons . eq ( 1 ) . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
121
+ } ) ;
92
122
} ) ;
93
123
94
124
describe ( 'uiGridExpandableService' , function ( ) {
0 commit comments