@@ -206,18 +206,22 @@ describe('ui.grid.edit uiGridCellNavService', function () {
206
206
207
207
} ) ;
208
208
209
+
210
+ // these have changed to use scrollToIfNecessary, which is better code
211
+ // but it means these unit tests are now mostly checking that it is the same it used to
212
+ // be, not that it is giving some specified result (i.e. I just updated them to what they were)
209
213
it ( 'should request scroll to row and column' , function ( ) {
210
214
uiGridCellNavService . scrollTo ( grid , grid . options . data [ 4 ] , grid . columns [ 4 ] . colDef ) ;
211
215
212
216
expect ( args . grid ) . toEqual ( grid ) ;
213
- expect ( args . y ) . toEqual ( { percentage : ( 3 + 3 / 9 ) / 10 } ) ;
214
- expect ( args . x ) . toEqual ( { percentage : ( 300 + 100 * 4 / 10 ) / 1500 } ) ;
217
+ expect ( args . y ) . toEqual ( { percentage : 5 / 11 } ) ;
218
+ expect ( isNaN ( args . x . percentage ) ) . toEqual ( true ) ;
215
219
} ) ;
216
220
217
221
it ( 'should request scroll to row only - first row' , function ( ) {
218
222
uiGridCellNavService . scrollTo ( grid , grid . options . data [ 0 ] , null ) ;
219
223
220
- expect ( args . y ) . toEqual ( { percentage : 0 } ) ;
224
+ expect ( args . y ) . toEqual ( { percentage : 2 / 11 } ) ;
221
225
} ) ;
222
226
223
227
it ( 'should request scroll to row only - last row' , function ( ) {
@@ -229,25 +233,25 @@ describe('ui.grid.edit uiGridCellNavService', function () {
229
233
it ( 'should request scroll to row only - row 4' , function ( ) {
230
234
uiGridCellNavService . scrollTo ( grid , grid . options . data [ 5 ] , null ) ;
231
235
232
- expect ( args . y ) . toEqual ( { percentage : ( 4 + 4 / 9 ) / 10 } ) ;
236
+ expect ( args . y ) . toEqual ( { percentage : 6 / 11 } ) ;
233
237
} ) ;
234
238
235
239
it ( 'should request scroll to column only - first column' , function ( ) {
236
240
uiGridCellNavService . scrollTo ( grid , null , grid . columns [ 0 ] . colDef ) ;
237
241
238
- expect ( args . x ) . toEqual ( { percentage : 0 } ) ;
242
+ expect ( isNaN ( args . x . percentage ) ) . toEqual ( true ) ;
239
243
} ) ;
240
244
241
245
it ( 'should request scroll to column only - last column' , function ( ) {
242
246
uiGridCellNavService . scrollTo ( grid , null , grid . columns [ 10 ] . colDef ) ;
243
247
244
- expect ( args . x ) . toEqual ( { percentage : 1 } ) ;
248
+ expect ( isNaN ( args . x . percentage ) ) . toEqual ( true ) ;
245
249
} ) ;
246
250
247
251
it ( 'should request scroll to column only - column 7' , function ( ) {
248
252
uiGridCellNavService . scrollTo ( grid , null , grid . columns [ 8 ] . colDef ) ;
249
253
250
- expect ( args . x ) . toEqual ( { percentage : ( 900 + 200 * 8 / 10 ) / 1500 } ) ;
254
+ expect ( isNaN ( args . x . percentage ) ) . toEqual ( true ) ;
251
255
} ) ;
252
256
253
257
it ( 'should request no scroll as no row or column' , function ( ) {
0 commit comments