@@ -34,6 +34,14 @@ describe('ui.grid.pinning uiGridPinningService', function () {
34
34
expect ( grid . options . enablePinning ) . toBe ( true ) ;
35
35
} ) ;
36
36
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
+
37
45
it ( 'should register a column builder to the grid' , function ( ) {
38
46
expect ( grid . registerColumnBuilder ) . toHaveBeenCalledWith ( uiGridPinningService . pinningColumnBuilder ) ;
39
47
} ) ;
@@ -50,6 +58,41 @@ describe('ui.grid.pinning uiGridPinningService', function () {
50
58
uiGridPinningService . defaultGridOptions ( options ) ;
51
59
expect ( options . enablePinning ) . toBe ( false ) ;
52
60
} ) ;
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
+
53
96
} ) ;
54
97
55
98
describe ( 'pinningColumnBuilder' , function ( ) {
@@ -58,7 +101,7 @@ describe('ui.grid.pinning uiGridPinningService', function () {
58
101
beforeEach ( function ( ) {
59
102
mockCol = { menuItems : [ ] , grid : grid } ;
60
103
colOptions = { } ;
61
- gridOptions = { enablePinning :true } ;
104
+ gridOptions = { enablePinning :true , hidePinLeft : false , hidePinRight : false } ;
62
105
} ) ;
63
106
64
107
it ( 'should enable column pinning when pinning allowed for the grid' , function ( ) {
@@ -84,6 +127,30 @@ describe('ui.grid.pinning uiGridPinningService', function () {
84
127
expect ( colOptions . enablePinning ) . toBe ( true ) ;
85
128
} ) ;
86
129
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
+
87
154
it ( 'should pin left when pinnedLeft=true' , function ( ) {
88
155
colOptions = { pinnedLeft : true } ;
89
156
gridOptions = { enablePinning : false } ;
0 commit comments