@zeedhi/teknisa-components-common 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/teknisa-components-common.es.js +3537 -0
- package/dist/teknisa-components-common.es.js.map +1 -0
- package/dist/types/components/tek-breadcrumb-header/breadcrumb-header.d.ts +2 -2
- package/dist/types/components/tek-breadcrumb-header/interfaces.d.ts +1 -1
- package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +1 -21
- package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +6 -28
- package/dist/types/components/tek-grid/filter-helper.d.ts +2 -2
- package/dist/types/components/tek-grid/grid-filter-button.d.ts +1 -0
- package/dist/types/components/tek-grid/grouped-data-manager.d.ts +8 -1
- package/dist/types/components/tek-grid/interfaces.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid-controller.d.ts +19 -17
- package/dist/types/components/tek-grid/tek-grid-data-editor.d.ts +11 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +1 -1
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid.d.ts +22 -5
- package/dist/types/components/tek-loading/interfaces.d.ts +1 -1
- package/dist/types/components/tek-loading/loading.d.ts +1 -1
- package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +4 -4
- package/dist/types/utils/extract-properties/extract-properties.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/report-filter/report-filter.d.ts +12 -0
- package/package.json +30 -12
- package/coverage/clover.xml +0 -6
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +0 -100
- package/coverage/lcov-report/tests/__helpers__/create-component.ts.html +0 -109
- package/coverage/lcov-report/tests/__helpers__/find-component.ts.html +0 -139
- package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +0 -94
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +0 -166
- package/coverage/lcov-report/tests/__helpers__/index.html +0 -221
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +0 -106
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +0 -121
- package/coverage/lcov-report/tests/__helpers__/spy-on-all-methods.ts.html +0 -223
- package/coverage/lcov.info +0 -0
- package/dist/teknisa-components-common.js +0 -3808
- package/dist/teknisa-components-common.min.js +0 -3808
- package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +0 -14
- package/environments.json +0 -26
- package/jest.config.cjs +0 -23
- package/src/components/index.ts +0 -101
- package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +0 -29
- package/src/components/tek-breadcrumb-header/interfaces.ts +0 -7
- package/src/components/tek-datasource/index.ts +0 -3
- package/src/components/tek-datasource/interfaces.ts +0 -36
- package/src/components/tek-datasource/tek-memory-datasource.ts +0 -314
- package/src/components/tek-datasource/tek-rest-datasource.ts +0 -224
- package/src/components/tek-grid/columns-searcher.ts +0 -22
- package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
- package/src/components/tek-grid/filter-helper.ts +0 -20
- package/src/components/tek-grid/grid-filter-button.ts +0 -421
- package/src/components/tek-grid/grouped-data-manager.ts +0 -448
- package/src/components/tek-grid/grouped-data-navigator.ts +0 -66
- package/src/components/tek-grid/grouped-data-selector.ts +0 -40
- package/src/components/tek-grid/index.ts +0 -18
- package/src/components/tek-grid/interfaces.ts +0 -329
- package/src/components/tek-grid/keymap-grouped.ts +0 -20
- package/src/components/tek-grid/layout-options.ts +0 -248
- package/src/components/tek-grid/tek-grid-column.ts +0 -193
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -38
- package/src/components/tek-grid/tek-grid-controller.ts +0 -140
- package/src/components/tek-grid/tek-grid-events.ts +0 -105
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
- package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
- package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -365
- package/src/components/tek-grid/tek-grid.ts +0 -1122
- package/src/components/tek-loading/interfaces.ts +0 -7
- package/src/components/tek-loading/loading.ts +0 -27
- package/src/components/tek-user-info/TekUserInfoController.ts +0 -87
- package/src/components/tek-user-info/interfaces.ts +0 -21
- package/src/components/tek-user-info/tek-user-info-list.ts +0 -64
- package/src/components/tek-user-info/tek-user-info.ts +0 -337
- package/src/error/tek-grid-delete-rows-error.ts +0 -15
- package/src/error/teknisa-common-error.ts +0 -8
- package/src/utils/config/config.ts +0 -8
- package/src/utils/index.ts +0 -3
- package/src/utils/is-filled-object/is-filled-object.ts +0 -5
- package/src/utils/is-nil.ts +0 -3
- package/tests/__helpers__/component-event-helper.ts +0 -5
- package/tests/__helpers__/create-component.ts +0 -8
- package/tests/__helpers__/find-component.ts +0 -18
- package/tests/__helpers__/flush-promises-helper.ts +0 -3
- package/tests/__helpers__/get-child-helper.ts +0 -27
- package/tests/__helpers__/index.ts +0 -7
- package/tests/__helpers__/mock-created-helper.ts +0 -12
- package/tests/__helpers__/spy-on-all-methods.ts +0 -46
- package/tests/__mocks__/@zeedhi/core/i18n.js +0 -75
- package/tests/__mocks__/@zeedhi/core.js +0 -5
- package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +0 -43
- package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +0 -463
- package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +0 -362
- package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
- package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
- package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
- package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -56
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
- package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
- package/tests/unit/components/tek-grid/grouped-data-navigator.spec.ts +0 -143
- package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
- package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
- package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
- package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -318
- package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -229
- package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
- package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
- package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
- package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -897
- package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
- package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
- package/tests/unit/components/tek-loading/loading.spec.ts +0 -29
- package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -220
- package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +0 -96
- package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +0 -442
- package/tests/unit/utils/mock-console.ts +0 -18
- package/tests/unit/utils/setup.ts +0 -5
- package/tsconfig.build.json +0 -7
- package/tsconfig.eslint.json +0 -9
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { DataNavigator } from '@zeedhi/common';
|
|
2
|
-
import { GroupedDataNavigator } from '../../../../src';
|
|
3
|
-
import { spyOnAllMethods } from '../../../__helpers__';
|
|
4
|
-
|
|
5
|
-
describe('GroupedDataNavigator', () => {
|
|
6
|
-
let navigator: GroupedDataNavigator;
|
|
7
|
-
let mockGrid: any;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
mockGrid = {
|
|
11
|
-
isGrouped: jest.fn(),
|
|
12
|
-
getGroupedData: jest.fn(),
|
|
13
|
-
datasource: { currentRow: {} },
|
|
14
|
-
getRowKey: jest.fn(),
|
|
15
|
-
isItemVisible: jest.fn().mockReturnValue(true),
|
|
16
|
-
setCurrentRow: jest.fn(),
|
|
17
|
-
getData: jest.fn().mockReturnValue([]),
|
|
18
|
-
getPage: jest.fn(),
|
|
19
|
-
getLastPage: jest.fn(),
|
|
20
|
-
setPage: jest.fn(),
|
|
21
|
-
selectCell: jest.fn(),
|
|
22
|
-
columns: [],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
navigator = new GroupedDataNavigator(mockGrid);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
jest.restoreAllMocks();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should initialize with the provided grid', () => {
|
|
33
|
-
expect(navigator).toBeInstanceOf(GroupedDataNavigator);
|
|
34
|
-
// @ts-ignore - access protected property for testing
|
|
35
|
-
expect(navigator.grid).toBe(mockGrid);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should delegate page navigation to DataNavigator', () => {
|
|
39
|
-
const spyObj = spyOnAllMethods(DataNavigator.prototype);
|
|
40
|
-
|
|
41
|
-
navigator.navigatePageUp();
|
|
42
|
-
navigator.navigatePageDown();
|
|
43
|
-
|
|
44
|
-
expect(spyObj.navigatePageUp).toHaveBeenCalled();
|
|
45
|
-
expect(spyObj.navigatePageDown).toHaveBeenCalled();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should delegate ungrouped datasource navigation to DataNavigator', () => {
|
|
49
|
-
const spyObj = spyOnAllMethods(DataNavigator.prototype);
|
|
50
|
-
mockGrid.isGrouped.mockReturnValue(false);
|
|
51
|
-
|
|
52
|
-
navigator.navigateDatasource('up');
|
|
53
|
-
|
|
54
|
-
expect(spyObj.navigateDatasource).toHaveBeenCalledWith('up');
|
|
55
|
-
expect(mockGrid.getGroupedData).not.toHaveBeenCalled();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('grouped datasource navigation', () => {
|
|
59
|
-
const groupedData = [
|
|
60
|
-
{ group: true, groupValue: 'Group1' },
|
|
61
|
-
{ id: 1, name: 'Item1' },
|
|
62
|
-
{ id: 2, name: 'Item2' },
|
|
63
|
-
{ group: true, groupValue: 'Group2' },
|
|
64
|
-
{ id: 3, name: 'Item3' },
|
|
65
|
-
{ groupFooter: true, groupValue: 'Group2' },
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
beforeEach(() => {
|
|
69
|
-
mockGrid.isGrouped.mockReturnValue(true);
|
|
70
|
-
mockGrid.getGroupedData.mockReturnValue(groupedData);
|
|
71
|
-
mockGrid.getRowKey.mockImplementation((row: any) => row.id);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should navigate to the previous visible row', () => {
|
|
75
|
-
mockGrid.datasource.currentRow = groupedData[2];
|
|
76
|
-
|
|
77
|
-
navigator.navigateDatasource('up');
|
|
78
|
-
|
|
79
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[1]);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should navigate to the next visible row', () => {
|
|
83
|
-
mockGrid.datasource.currentRow = groupedData[1];
|
|
84
|
-
|
|
85
|
-
navigator.navigateDatasource('down');
|
|
86
|
-
|
|
87
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[2]);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should find the current group by group value', () => {
|
|
91
|
-
mockGrid.datasource.currentRow = groupedData[3];
|
|
92
|
-
|
|
93
|
-
navigator.navigateDatasource('down');
|
|
94
|
-
|
|
95
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[4]);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('should skip group footers and invisible rows', () => {
|
|
99
|
-
mockGrid.datasource.currentRow = groupedData[4];
|
|
100
|
-
mockGrid.isItemVisible.mockImplementation((row: any) => row !== groupedData[3]);
|
|
101
|
-
|
|
102
|
-
navigator.navigateDatasource('up');
|
|
103
|
-
|
|
104
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[2]);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should navigate to the last valid row when currentRow is not defined', () => {
|
|
108
|
-
mockGrid.datasource.currentRow = {};
|
|
109
|
-
|
|
110
|
-
navigator.navigateDatasource('up');
|
|
111
|
-
|
|
112
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[4]);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('should navigate to the first valid row when currentRow is not defined', () => {
|
|
116
|
-
mockGrid.datasource.currentRow = {};
|
|
117
|
-
|
|
118
|
-
navigator.navigateDatasource('down');
|
|
119
|
-
|
|
120
|
-
expect(mockGrid.setCurrentRow).toHaveBeenCalledWith(groupedData[0]);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should stop at the beginning and end of grouped data', () => {
|
|
124
|
-
mockGrid.datasource.currentRow = groupedData[0];
|
|
125
|
-
mockGrid.getRowKey.mockImplementation((row: any) => row.groupValue || row.id);
|
|
126
|
-
|
|
127
|
-
navigator.navigateDatasource('up');
|
|
128
|
-
expect(mockGrid.setCurrentRow).not.toHaveBeenCalled();
|
|
129
|
-
|
|
130
|
-
mockGrid.datasource.currentRow = groupedData[4];
|
|
131
|
-
navigator.navigateDatasource('down');
|
|
132
|
-
expect(mockGrid.setCurrentRow).not.toHaveBeenCalled();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should do nothing when grouped data is empty', () => {
|
|
136
|
-
mockGrid.getGroupedData.mockReturnValue([]);
|
|
137
|
-
|
|
138
|
-
navigator.navigateDatasource('down');
|
|
139
|
-
|
|
140
|
-
expect(mockGrid.setCurrentRow).not.toHaveBeenCalled();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { GroupedDataSelector } from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('GroupedDataSelector', () => {
|
|
4
|
-
let groupedDataSelector: GroupedDataSelector;
|
|
5
|
-
let mockIterable: any;
|
|
6
|
-
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
mockIterable = {
|
|
9
|
-
selectionState: { allSelected: false, except: [] },
|
|
10
|
-
selectedRows: [],
|
|
11
|
-
selectable: true,
|
|
12
|
-
isGrouped: jest.fn(),
|
|
13
|
-
getGroupedData: jest.fn(),
|
|
14
|
-
getData: jest.fn(),
|
|
15
|
-
getRowKey: jest.fn((row) => row.id),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
groupedDataSelector = new GroupedDataSelector(mockIterable);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('selectAll', () => {
|
|
22
|
-
it('should do nothing if iterable is not selectable', () => {
|
|
23
|
-
mockIterable.selectable = false;
|
|
24
|
-
groupedDataSelector.selectAll(true);
|
|
25
|
-
expect(mockIterable.selectionState).toEqual({ allSelected: false, except: [] });
|
|
26
|
-
expect(mockIterable.selectedRows).toEqual([]);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const testData = [
|
|
30
|
-
{ id: 1, name: 'Item 1' },
|
|
31
|
-
{ id: 2, name: 'Item 2' },
|
|
32
|
-
{ id: 3, name: 'Item 3' },
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
it('when selecting all, should set selectionState and add all rows to selectedRows', () => {
|
|
36
|
-
mockIterable.getData = jest.fn(() => testData);
|
|
37
|
-
groupedDataSelector.selectAll(true);
|
|
38
|
-
|
|
39
|
-
expect(mockIterable.selectionState).toEqual({ allSelected: true, except: [] });
|
|
40
|
-
expect(mockIterable.selectedRows).toEqual(testData);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('when selecting all, should skip rows where callDisableSelection returns true', () => {
|
|
44
|
-
mockIterable.getData = jest.fn(() => testData);
|
|
45
|
-
groupedDataSelector.callDisableSelection = jest.fn((row) => row.id === 2);
|
|
46
|
-
|
|
47
|
-
groupedDataSelector.selectAll(true);
|
|
48
|
-
|
|
49
|
-
expect(mockIterable.selectedRows).toEqual([
|
|
50
|
-
{ id: 1, name: 'Item 1' },
|
|
51
|
-
{ id: 3, name: 'Item 3' },
|
|
52
|
-
]);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('when selecting all, should skip rows that are already selected', () => {
|
|
56
|
-
mockIterable.getData = jest.fn(() => testData);
|
|
57
|
-
mockIterable.selectedRows = [testData[0]];
|
|
58
|
-
|
|
59
|
-
groupedDataSelector.selectAll(true);
|
|
60
|
-
|
|
61
|
-
expect(mockIterable.selectedRows).toEqual(testData); // should not duplicate
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('when selecting all, should work with grouped data', () => {
|
|
65
|
-
const groupedData = [
|
|
66
|
-
{ id: 1, group: '1' }, { id: 2, group: '1' }, { id: 3, group: '2' },
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
mockIterable.isGrouped = jest.fn(() => true);
|
|
70
|
-
mockIterable.getGroupedData = jest.fn(() => groupedData);
|
|
71
|
-
|
|
72
|
-
groupedDataSelector.selectAll(true);
|
|
73
|
-
|
|
74
|
-
expect(mockIterable.selectedRows).toEqual(groupedData);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('when deselecting all, should set selectionState and remove all rows from selectedRows', () => {
|
|
78
|
-
mockIterable.getData = jest.fn(() => testData);
|
|
79
|
-
mockIterable.selectedRows = [...testData];
|
|
80
|
-
groupedDataSelector.selectAll(false);
|
|
81
|
-
|
|
82
|
-
expect(mockIterable.selectionState).toEqual({ allSelected: false, except: [] });
|
|
83
|
-
expect(mockIterable.selectedRows).toEqual([]);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('when deselecting all, should only remove rows that exist in the data', () => {
|
|
87
|
-
mockIterable.getData = jest.fn(() => []);
|
|
88
|
-
mockIterable.selectedRows.push({ id: 99, name: 'Extra item' });
|
|
89
|
-
|
|
90
|
-
groupedDataSelector.selectAll(false);
|
|
91
|
-
|
|
92
|
-
expect(mockIterable.selectedRows).toEqual([{ id: 99, name: 'Extra item' }]);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('when deselecting all, should work with grouped data', () => {
|
|
96
|
-
const groupedData = [
|
|
97
|
-
{ id: 1, group: '1' }, { id: 2, group: '1' }, { id: 3, group: '2' },
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
mockIterable.isGrouped = jest.fn(() => true);
|
|
101
|
-
mockIterable.getGroupedData = jest.fn(() => groupedData);
|
|
102
|
-
|
|
103
|
-
groupedDataSelector.selectAll(false);
|
|
104
|
-
|
|
105
|
-
expect(mockIterable.selectedRows).toEqual([]);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe('getData', () => {
|
|
110
|
-
it('should call getGroupedData when iterable is grouped', () => {
|
|
111
|
-
mockIterable.isGrouped.mockReturnValue(true);
|
|
112
|
-
const expectedData = [{ group: 'Test', items: [] }];
|
|
113
|
-
mockIterable.getGroupedData.mockReturnValue(expectedData);
|
|
114
|
-
|
|
115
|
-
// @ts-ignore - access private method for testing
|
|
116
|
-
const result = groupedDataSelector.getData();
|
|
117
|
-
|
|
118
|
-
expect(result).toEqual(expectedData);
|
|
119
|
-
expect(mockIterable.isGrouped).toHaveBeenCalled();
|
|
120
|
-
expect(mockIterable.getGroupedData).toHaveBeenCalled();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should call getData when iterable is not grouped', () => {
|
|
124
|
-
mockIterable.isGrouped.mockReturnValue(false);
|
|
125
|
-
const expectedData = [{ id: 1 }, { id: 2 }];
|
|
126
|
-
mockIterable.getData.mockReturnValue(expectedData);
|
|
127
|
-
|
|
128
|
-
// @ts-ignore - access private method for testing
|
|
129
|
-
const result = groupedDataSelector.getData();
|
|
130
|
-
|
|
131
|
-
expect(result).toEqual(expectedData);
|
|
132
|
-
expect(mockIterable.isGrouped).toHaveBeenCalled();
|
|
133
|
-
expect(mockIterable.getData).toHaveBeenCalled();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { KeyMapGrouped } from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('KeyMapGrouped', () => {
|
|
4
|
-
it('should return a keymap', () => {
|
|
5
|
-
const instance = { directionalLeft: jest.fn(), directionalRight: jest.fn() } as any;
|
|
6
|
-
const keyMap = new KeyMapGrouped().getMap(instance);
|
|
7
|
-
expect(keyMap).toEqual(expect.objectContaining({
|
|
8
|
-
left: {
|
|
9
|
-
event: expect.any(Function),
|
|
10
|
-
stop: true,
|
|
11
|
-
active: true,
|
|
12
|
-
},
|
|
13
|
-
right: {
|
|
14
|
-
event: expect.any(Function),
|
|
15
|
-
stop: true,
|
|
16
|
-
active: true,
|
|
17
|
-
},
|
|
18
|
-
}));
|
|
19
|
-
});
|
|
20
|
-
});
|