Skip to content

Commit

Permalink
chore: fix some TS Types in a few unit tests (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Nov 30, 2022
1 parent 35c2631 commit b4ffd6e
Show file tree
Hide file tree
Showing 12 changed files with 427 additions and 427 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('CellExternalCopyManager', () => {

plugin.init(gridStub);
const eventData = { ...new Slick.EventData(), preventDefault: jest.fn() };
mockCellSelectionModel.onSelectedRangesChanged.notify({ fromCell: 0, fromRow: 0, toCell: 0, toRow: 0 }, eventData, gridStub);
mockCellSelectionModel.onSelectedRangesChanged.notify([{ fromCell: 0, fromRow: 0, toCell: 0, toRow: 0 }], eventData, gridStub);

expect(gridFocusSpy).toHaveBeenCalled();
});
Expand Down
112 changes: 56 additions & 56 deletions packages/common/src/extensions/__tests__/slickCellMenu.plugin.spec.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ describe('CellRangeDecorator Plugin', () => {
plugin = new SlickCellRangeDecorator(gridStub, { offset: { top: 20, left: 5, width: 12, height: 33 } });
plugin.show({ fromCell: 1, fromRow: 2, toCell: 3, toRow: 4 });

expect(plugin.addonElement.style.top).toEqual('');
expect(plugin.addonElement.style.left).toEqual('');
expect(plugin.addonElement.style.height).toEqual('');
expect(plugin.addonElement.style.width).toEqual('');
expect(plugin.addonElement!.style.top).toEqual('');
expect(plugin.addonElement!.style.left).toEqual('');
expect(plugin.addonElement!.style.height).toEqual('');
expect(plugin.addonElement!.style.width).toEqual('');
});

it('should Show range when called and calculate new position when getCellNodeBox returns a cell position', () => {
Expand All @@ -75,9 +75,9 @@ describe('CellRangeDecorator Plugin', () => {
plugin = new SlickCellRangeDecorator(gridStub, { offset: { top: 20, left: 5, width: 12, height: 33 } });
plugin.show({ fromCell: 1, fromRow: 2, toCell: 3, toRow: 4 });

expect(plugin.addonElement.style.top).toEqual('45px'); // 25 + 20px
expect(plugin.addonElement.style.left).toEqual('31px'); // 26 + 5px
expect(plugin.addonElement.style.height).toEqual('20px'); // 12 - 25 + 33px
expect(plugin.addonElement.style.width).toEqual('13px'); // 27 - 26 + 12px
expect(plugin.addonElement!.style.top).toEqual('45px'); // 25 + 20px
expect(plugin.addonElement!.style.left).toEqual('31px'); // 26 + 5px
expect(plugin.addonElement!.style.height).toEqual('20px'); // 12 - 25 + 33px
expect(plugin.addonElement!.style.width).toEqual('13px'); // 27 - 26 + 12px
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('CellSelectionModel Plugin', () => {
it('should create the plugin and initialize it with just "selectActiveCell" option and still expect the same result', () => {
const registerSpy = jest.spyOn(gridStub, 'registerPlugin');

plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined });
plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined as any });
plugin.init(gridStub);

expect(plugin.cellRangeSelector).toBeTruthy();
Expand All @@ -142,7 +142,7 @@ describe('CellSelectionModel Plugin', () => {
it('should expect that "setSelectedRanges" is being triggered when "refreshSelections" is called', () => {
const registerSpy = jest.spyOn(gridStub, 'registerPlugin');

plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined });
plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined as any });
plugin.init(gridStub);

jest.spyOn(plugin, 'getSelectedRanges').mockReturnValue([
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('CellSelectionModel Plugin', () => {
});

it('should call "setSelectedRanges" with Slick Ranges when triggered by "onActiveCellChanged" and "selectActiveCell" is True', () => {
plugin = new SlickCellSelectionModel({ selectActiveCell: true, cellRangeSelector: undefined });
plugin = new SlickCellSelectionModel({ selectActiveCell: true, cellRangeSelector: undefined as any });
plugin.init(gridStub);
const setSelectRangeSpy = jest.spyOn(plugin, 'setSelectedRanges');
const mouseEvent = addJQueryEventPropagation(new Event('mouseenter'));
Expand All @@ -200,7 +200,7 @@ describe('CellSelectionModel Plugin', () => {
});

it('should call "setSelectedRanges" with empty array when triggered by "onActiveCellChanged" and "selectActiveCell" is False', () => {
plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined });
plugin = new SlickCellSelectionModel({ selectActiveCell: false, cellRangeSelector: undefined as any });
plugin.init(gridStub);
const setSelectRangeSpy = jest.spyOn(plugin, 'setSelectedRanges');
const mouseEvent = addJQueryEventPropagation(new Event('mouseenter'));
Expand Down
Loading

0 comments on commit b4ffd6e

Please sign in to comment.