Skip to content

Commit 3b24342

Browse files
committed
Merge pull request #2803 from PaulL1/saveState_scrollTo
Fix (saveState): update call to scrollTo
2 parents e7bd6f2 + 2dc9db3 commit 3b24342

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/features/saveState/js/saveState.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,9 @@
484484

485485
if ( colDef || entity ) {
486486
if (scrollFocusState.focus ){
487-
grid.api.cellNav.scrollToFocus( $scope, entity, colDef );
487+
grid.api.cellNav.scrollToFocus( entity, colDef );
488488
} else {
489-
grid.api.cellNav.scrollTo( $scope, entity, colDef );
489+
grid.api.cellNav.scrollTo( entity, colDef );
490490
}
491491
}
492492
},

src/features/saveState/test/saveState.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
334334
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, rowVal: { identity: false, row: 2 } } );
335335

336336
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
337-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, grid.rows[3].entity, undefined );
337+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( grid.rows[3].entity, undefined );
338338
});
339339

340340
it('restores focus row only, with identity function', function() {
@@ -350,7 +350,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
350350
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, rowVal: { identity: true, row: 'a_3' } } );
351351

352352
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
353-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, grid.rows[3].entity, undefined );
353+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( grid.rows[3].entity, undefined );
354354
});
355355

356356
it('restores focus col only, without identity function', function() {
@@ -361,7 +361,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
361361
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, colName: 'col2' } );
362362

363363
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
364-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, null, grid.options.columnDefs[1] );
364+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( null, grid.options.columnDefs[1] );
365365
});
366366

367367
it('restores focus col only, with identity function', function() {
@@ -377,7 +377,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
377377
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, colName: 'col2' } );
378378

379379
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
380-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, null, grid.options.columnDefs[1] );
380+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( null, grid.options.columnDefs[1] );
381381
});
382382

383383
it('restores focus col and row, without identity function', function() {
@@ -388,7 +388,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
388388
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, colName: 'col2', rowVal: { identity: false, row: 2 } } );
389389

390390
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
391-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, grid.rows[3].entity, grid.options.columnDefs[1] );
391+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( grid.rows[3].entity, grid.options.columnDefs[1] );
392392
});
393393

394394
it('restores focus col and row, with identity function', function() {
@@ -404,7 +404,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
404404
uiGridSaveStateService.restoreScrollFocus( grid, $scope, { focus: true, colName: 'col2', rowVal: { identity: true, row: 'a_3' } } );
405405

406406
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
407-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, grid.rows[3].entity, grid.options.columnDefs[1] );
407+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( grid.rows[3].entity, grid.options.columnDefs[1] );
408408
});
409409

410410
});
@@ -532,7 +532,7 @@ describe('ui.grid.saveState uiGridSaveStateService', function () {
532532

533533
expect( grid.api.selection.getSelectedGridRows() ).toEqual( [ grid.rows[0], grid.rows[3] ] );
534534
expect( grid.api.cellNav.scrollTo ).not.toHaveBeenCalled();
535-
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( $scope, grid.rows[2].entity, grid.options.columnDefs[3] );
535+
expect( grid.api.cellNav.scrollToFocus ).toHaveBeenCalledWith( grid.rows[2].entity, grid.options.columnDefs[3] );
536536
});
537537
});
538538
});

0 commit comments

Comments
 (0)