@@ -223,8 +223,14 @@ describe('ui.grid.selection uiGridSelectionService', function () {
223
223
}
224
224
expect ( grid . selection . selectAll ) . toBe ( false ) ;
225
225
226
+ grid . options . isRowSelectable = function ( row ) {
227
+ return row . isRowSelectable !== false ;
228
+ } ;
229
+
230
+ grid . rows [ 6 ] . isRowSelectable = false ;
226
231
grid . rows [ 8 ] . enableSelection = false ;
227
232
grid . api . selection . selectAllRows ( ) ;
233
+ expect ( grid . rows [ 6 ] . isSelected ) . toBe ( false ) ;
228
234
expect ( grid . rows [ 7 ] . isSelected ) . toBe ( true ) ;
229
235
expect ( grid . rows [ 8 ] . isSelected ) . toBe ( false ) ;
230
236
} ) ;
@@ -244,18 +250,22 @@ describe('ui.grid.selection uiGridSelectionService', function () {
244
250
} ) ;
245
251
246
252
describe ( 'selectAllVisibleRows function' , function ( ) {
247
- it ( 'should select all visible rows' , function ( ) {
253
+ it ( 'should select all visible and selectable rows' , function ( ) {
248
254
grid . api . selection . selectRow ( grid . rows [ 4 ] . entity ) ;
249
255
expect ( grid . rows [ 4 ] . isSelected ) . toBe ( true ) ;
250
256
251
257
grid . api . selection . selectRow ( grid . rows [ 6 ] . entity ) ;
252
258
expect ( grid . rows [ 4 ] . isSelected ) . toBe ( true ) ;
253
259
expect ( grid . rows [ 6 ] . isSelected ) . toBe ( true ) ;
254
260
261
+ grid . options . isRowSelectable = function ( row ) {
262
+ return row . isRowSelectable !== false ;
263
+ } ;
255
264
grid . rows [ 3 ] . visible = true ;
256
265
grid . rows [ 4 ] . visible = true ;
257
266
grid . rows [ 6 ] . visible = false ;
258
267
grid . rows [ 7 ] . visible = true ;
268
+ grid . rows [ 7 ] . isRowSelectable = false ;
259
269
grid . rows [ 8 ] . enableSelection = false ;
260
270
grid . rows [ 9 ] . visible = true ;
261
271
expect ( grid . selection . selectAll ) . toBe ( false ) ;
@@ -264,11 +274,11 @@ describe('ui.grid.selection uiGridSelectionService', function () {
264
274
expect ( grid . rows [ 3 ] . isSelected ) . toBe ( true ) ;
265
275
expect ( grid . rows [ 4 ] . isSelected ) . toBe ( true ) ;
266
276
expect ( grid . rows [ 6 ] . isSelected ) . toBe ( false ) ;
267
- expect ( grid . rows [ 7 ] . isSelected ) . toBe ( true ) ;
277
+ expect ( grid . rows [ 7 ] . isSelected ) . toBe ( false ) ;
268
278
expect ( grid . rows [ 8 ] . isSelected ) . toBe ( false ) ;
269
279
expect ( grid . rows [ 9 ] . isSelected ) . toBe ( true ) ;
270
280
expect ( grid . selection . selectAll ) . toBe ( true ) ;
271
- expect ( grid . selection . selectedCount ) . toBe ( 8 ) ;
281
+ expect ( grid . selection . selectedCount ) . toBe ( 7 ) ;
272
282
} ) ;
273
283
} ) ;
274
284
0 commit comments