Skip to content

Commit

Permalink
test(grid): use API calls to methods instead of using shift+tab #3583
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipata committed Feb 19, 2019
1 parent 342b8d6 commit 170ac12
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3125,31 +3125,27 @@ describe('IgxGrid Component Tests', () => {
fixture.detectChanges();

const grid = fixture.componentInstance.grid;
const cellDate = grid.getCellByColumn(0, 'OrderDate');
let cellDate = grid.getCellByColumn(0, 'OrderDate');
const initialState = grid.transactions.getAggregatedChanges(false);

// Enter edit mode
cellDate.onKeydownEnterEditMode({ stopPropagation: () => { }, preventDefault: () => { } });
tick();
fixture.detectChanges();
// Perform Shift + Tab to UnitsInStock
cellDate.nativeElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'tab', shiftKey: true, code: 'tab' }));
// Exit edit mode without change
cellDate.onKeydownExitEditMode({ stopPropagation: () => { }, preventDefault: () => { } });
tick();
fixture.detectChanges();
// Exit edit mode
grid.endEdit(true);
cellDate = grid.getCellByColumn(0, 'UnitsInStock');
cellDate.onKeydownEnterEditMode({ stopPropagation: () => { }, preventDefault: () => { } });
tick();
fixture.detectChanges();
expect(grid.transactions.getAggregatedChanges(true)).toEqual(initialState);
cellDate.onKeydownExitEditMode({ stopPropagation: () => { }, preventDefault: () => { } });

// Enter edit mode
cellDate.onKeydownEnterEditMode({ stopPropagation: () => { }, preventDefault: () => { } });
tick();
fixture.detectChanges();
cellDate = grid.getCellByColumn(0, 'OrderDate');
const newValue = new Date('01/01/2000');
cellDate.update(newValue);
// Exit edit mode
grid.endEdit(true);
tick();
fixture.detectChanges();

Expand Down

0 comments on commit 170ac12

Please sign in to comment.