Skip to content

Commit

Permalink
Merge pull request #521 from ghiscoding/feat/internal-row-selections
Browse files Browse the repository at this point in the history
feat(plugins): move Checkbox and Row Selection plugins to universal
  • Loading branch information
ghiscoding authored Oct 15, 2021
2 parents f7d4e44 + 44c7731 commit 5429c91
Show file tree
Hide file tree
Showing 37 changed files with 1,860 additions and 623 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 class="title is-3">
<span class.bind="sortingEnabledClass"></span>
<span>Toggle Sorting</span>
</button>
<button class="button is-small" data-test="delete-clear-filters-btn" onclick.delegate="clearFilters()">
<button class="button is-small" data-test="clear-filters-btn" onclick.delegate="clearFilters()">
<span class="icon mdi mdi-close"></span>
<span>Clear Filters</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/editors/autoCompleteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class AutoCompleteEditor implements Editor {

/** Getter for the Grid Options pulled through the Grid Object */
get gridOptions(): GridOption {
return (this.grid && this.grid.getOptions) ? this.grid.getOptions() : {};
return this.grid?.getOptions?.() ?? {};
}

/** jQuery UI AutoComplete instance */
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/enums/slickPluginList.enum.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {
SlickCheckboxSelectColumn,
SlickEditorLock,
SlickGroupItemMetadataProvider,
SlickRowDetailView,
SlickRowMoveManager,
SlickRowSelectionModel,
} from '../interfaces/index';
import {
SlickAutoTooltip,
Expand All @@ -13,10 +11,12 @@ import {
SlickCellRangeDecorator,
SlickCellRangeSelector,
SlickCellSelectionModel,
SlickCheckboxSelectColumn,
SlickContextMenu,
SlickDraggableGrouping,
SlickHeaderButtons,
SlickHeaderMenu,
SlickRowSelectionModel,
} from '../plugins/index';

export type SlickPluginList =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const mockAddon = jest.fn().mockImplementation(() => ({
destroy: jest.fn()
}));

jest.mock('slickgrid/plugins/slick.rowselectionmodel', () => mockAddon);
jest.mock('slickgrid/plugins/slick.rowdetailview', () => mockAddon);
jest.mock('slickgrid/plugins/slick.rowmovemanager', () => mockAddon);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ Slick.Plugins = {
RowDetailView: mockAddon
} as any;

jest.mock('slickgrid/plugins/slick.rowselectionmodel', () => mockSelectionModel);
Slick.RowSelectionModel = mockSelectionModel;

describe('rowDetailViewExtension', () => {
it('should display a not implemented when calling "create" method', () => {
expect(() => RowDetailViewExtension.prototype.create!([] as Column[], {} as GridOption)).toThrow('[Slickgrid-Universal] RowDetailViewExtension "create" method is not yet implemented');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { RowMoveManagerExtension } from '../rowMoveManagerExtension';
import { SharedService } from '../../services/shared.service';
import { TranslateServiceStub } from '../../../../../test/translateServiceStub';
import { Column, GridOption, RowMoveManager, SlickGrid, SlickNamespace, SlickRowMoveManager } from '../../interfaces/index';
import { SlickRowSelectionModel } from '../../plugins/slickRowSelectionModel';

declare const Slick: SlickNamespace;

Expand All @@ -20,18 +21,26 @@ const mockAddon = jest.fn().mockImplementation(() => ({
onMoveRows: new Slick.Event(),
}));

const mockSelectionModel = jest.fn().mockImplementation(() => ({
const mockRowSelectionModel = {
constructor: jest.fn(),
init: jest.fn(),
destroy: jest.fn()
destroy: jest.fn(),
dispose: jest.fn(),
getSelectedRows: jest.fn(),
setSelectedRows: jest.fn(),
getSelectedRanges: jest.fn(),
setSelectedRanges: jest.fn(),
onSelectedRangesChanged: new Slick.Event(),
} as unknown as SlickRowSelectionModel;

jest.mock('../../plugins/slickRowSelectionModel', () => ({
SlickRowSelectionModel: jest.fn().mockImplementation(() => mockRowSelectionModel),
}));

describe('rowMoveManagerExtension', () => {
jest.mock('slickgrid/plugins/slick.rowmovemanager', () => mockAddon);
Slick.RowMoveManager = mockAddon;

jest.mock('slickgrid/plugins/slick.rowselectionmodel', () => mockSelectionModel);
Slick.RowSelectionModel = mockSelectionModel;

let sharedService: SharedService;
let translateService: TranslateServiceStub;
let extension: RowMoveManagerExtension;
Expand Down

This file was deleted.

Loading

0 comments on commit 5429c91

Please sign in to comment.