@@ -34,6 +34,14 @@ describe('ui.grid.pinning uiGridPinningService', function () {
3434 expect ( grid . options . enablePinning ) . toBe ( true ) ;
3535 } ) ;
3636
37+ it ( 'should have hide PinLeft disabled' , function ( ) {
38+ expect ( grid . options . hidePinLeft ) . toBeFalsy ( ) ;
39+ } ) ;
40+
41+ it ( 'should have hide PinRight disabled' , function ( ) {
42+ expect ( grid . options . hidePinRight ) . toBeFalsy ( ) ;
43+ } ) ;
44+
3745 it ( 'should register a column builder to the grid' , function ( ) {
3846 expect ( grid . registerColumnBuilder ) . toHaveBeenCalledWith ( uiGridPinningService . pinningColumnBuilder ) ;
3947 } ) ;
@@ -50,6 +58,41 @@ describe('ui.grid.pinning uiGridPinningService', function () {
5058 uiGridPinningService . defaultGridOptions ( options ) ;
5159 expect ( options . enablePinning ) . toBe ( false ) ;
5260 } ) ;
61+
62+ it ( 'should default to false for hidePinLeft' , function ( ) {
63+ var options = { } ;
64+ uiGridPinningService . defaultGridOptions ( options ) ;
65+ expect ( options . hidePinLeft ) . toBeFalsy ( ) ;
66+ } ) ;
67+ it ( 'should allow true for hidePinLeft when pinning is enabled' , function ( ) {
68+ var options = { enablePinning : true , hidePinLeft : true } ;
69+ uiGridPinningService . defaultGridOptions ( options ) ;
70+ expect ( options . hidePinLeft ) . toBe ( true ) ;
71+ } ) ;
72+ it ( 'should NOT allow true for hidePinLeft when pinning is Disabled' , function ( ) {
73+ var options = { enablePinning : false , hidePinLeft : true } ;
74+ uiGridPinningService . defaultGridOptions ( options ) ;
75+ expect ( options . hidePinLeft ) . toBe ( false ) ;
76+ } ) ;
77+
78+
79+ it ( 'should default to false for hidePinRight' , function ( ) {
80+ var options = { } ;
81+ uiGridPinningService . defaultGridOptions ( options ) ;
82+ expect ( options . hidePinRight ) . toBeFalsy ( ) ;
83+ } ) ;
84+ it ( 'should allow true for hidePinRight when pinning is enabled' , function ( ) {
85+ var options = { enablePinning : true , hidePinRight : true } ;
86+ uiGridPinningService . defaultGridOptions ( options ) ;
87+ expect ( options . hidePinRight ) . toBe ( true ) ;
88+ } ) ;
89+ it ( 'should NOT allow true for hidePinRight when pinning is Disabled' , function ( ) {
90+ var options = { enablePinning : false , hidePinRight : true } ;
91+ uiGridPinningService . defaultGridOptions ( options ) ;
92+ expect ( options . hidePinRight ) . toBe ( false ) ;
93+ } ) ;
94+
95+
5396 } ) ;
5497
5598 describe ( 'pinningColumnBuilder' , function ( ) {
@@ -58,7 +101,7 @@ describe('ui.grid.pinning uiGridPinningService', function () {
58101 beforeEach ( function ( ) {
59102 mockCol = { menuItems : [ ] , grid : grid } ;
60103 colOptions = { } ;
61- gridOptions = { enablePinning :true } ;
104+ gridOptions = { enablePinning :true , hidePinLeft : false , hidePinRight : false } ;
62105 } ) ;
63106
64107 it ( 'should enable column pinning when pinning allowed for the grid' , function ( ) {
@@ -84,6 +127,30 @@ describe('ui.grid.pinning uiGridPinningService', function () {
84127 expect ( colOptions . enablePinning ) . toBe ( true ) ;
85128 } ) ;
86129
130+ it ( 'should be true in columnOptions when hidePinLeft=true for the grid' , function ( ) {
131+ gridOptions = { enablePinning : true , hidePinLeft : true } ;
132+
133+ uiGridPinningService . pinningColumnBuilder ( colOptions , mockCol , gridOptions ) ;
134+
135+ expect ( colOptions . hidePinLeft ) . toBe ( true ) ;
136+ } ) ;
137+ it ( 'should be true when hidePinLeft=true for the column' , function ( ) {
138+ colOptions = { enablePinning : true , hidePinLeft : true } ;
139+ gridOptions = { enablePinning : true , hidePinLeft : false } ;
140+
141+ uiGridPinningService . pinningColumnBuilder ( colOptions , mockCol , gridOptions ) ;
142+
143+ expect ( colOptions . hidePinLeft ) . toBe ( true ) ;
144+ } ) ;
145+ it ( 'should be true when hidePinRight=true for the column' , function ( ) {
146+ colOptions = { enablePinning : true , hidePinRight : true } ;
147+ gridOptions = { enablePinning : true , hidePinRight : false } ;
148+
149+ uiGridPinningService . pinningColumnBuilder ( colOptions , mockCol , gridOptions ) ;
150+
151+ expect ( colOptions . hidePinRight ) . toBe ( true ) ;
152+ } ) ;
153+
87154 it ( 'should pin left when pinnedLeft=true' , function ( ) {
88155 colOptions = { pinnedLeft : true } ;
89156 gridOptions = { enablePinning : false } ;
0 commit comments