@@ -255,7 +255,7 @@ describe('ui-grid-menu-button uiGridGridMenuService', function() {
255
255
} ) ;
256
256
$scope . $digest ( ) ;
257
257
258
- expect ( menuItems . length ) . toEqual ( 6 , 'Should be 10 items, 1 columns header, 4 columns that allow hiding and Clean all filters' ) ;
258
+ expect ( menuItems . length ) . toEqual ( 6 , 'Should be 6 items, 1 columns header, 4 columns that allow hiding and Clean all filters' ) ;
259
259
expect ( menuItems [ 0 ] . title ) . toEqual ( 'Clear all filters' , 'Menu item 0 should be Clear all filters' ) ;
260
260
expect ( menuItems [ 1 ] . title ) . toEqual ( 'Columns:' , 'Menu item 0 should be header' ) ;
261
261
expect ( menuItems [ 1 ] . templateUrl ) . toEqual ( 'ui-grid/ui-grid-menu-header-item' ) ;
@@ -264,6 +264,23 @@ describe('ui-grid-menu-button uiGridGridMenuService', function() {
264
264
expect ( menuItems [ 4 ] . title ) . toEqual ( 'resolve_2' , 'Promise now resolved' ) ;
265
265
expect ( menuItems [ 5 ] . title ) . toEqual ( 'resolve_3' , 'Promise now resolved' ) ;
266
266
} ) ;
267
+ it ( 'should not add any columns if enableHiding if false and not enable on any columns' , function ( ) {
268
+ grid . options . enableHiding = false ;
269
+ menuItems = uiGridGridMenuService . getMenuItems ( $scope ) ;
270
+
271
+ expect ( menuItems . length ) . toEqual ( 1 , 'Should be 1 items, the clear all filters button' ) ;
272
+ expect ( menuItems [ 0 ] . title ) . toEqual ( 'Clear all filters' , 'Menu item 0 should be Clear all filters' ) ;
273
+ } ) ;
274
+ it ( 'should add any columns if enableHiding if false, but enabled on one columns' , function ( ) {
275
+ grid . options . enableHiding = false ;
276
+ grid . options . columnDefs [ 1 ] . enableHiding = true ;
277
+ menuItems = uiGridGridMenuService . getMenuItems ( $scope ) ;
278
+
279
+ expect ( menuItems . length ) . toEqual ( 3 , 'Should be 3 items, 1 columns header, 1 columns that allow hiding and Clean all filters' ) ;
280
+ expect ( menuItems [ 1 ] . title ) . toEqual ( 'Columns:' , 'Menu item 0 should be header' ) ;
281
+ expect ( menuItems [ 1 ] . templateUrl ) . toEqual ( 'ui-grid/ui-grid-menu-header-item' ) ;
282
+ expect ( menuItems [ 2 ] . title ) . toEqual ( 'Col2' , 'Column heading' ) ;
283
+ } ) ;
267
284
} ) ;
268
285
269
286
describe ( 'showHideColumns: ' , function ( ) {
0 commit comments