@zeedhi/teknisa-components-common 1.100.0 → 1.100.1
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/coverage/clover.xml +135 -135
- package/coverage/coverage-final.json +6 -6
- package/coverage/lcov-report/index.html +19 -19
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
- package/coverage/lcov.info +187 -187
- package/package.json +2 -2
- package/tests/unit/components/tek-grid/grid.spec.ts +151 -0
|
@@ -2034,6 +2034,79 @@ describe('TekGrid', () => {
|
|
|
2034
2034
|
});
|
|
2035
2035
|
});
|
|
2036
2036
|
|
|
2037
|
+
describe('rowDoubleClick', () => {
|
|
2038
|
+
it('rowDoubleClick method should call events.rowDoubleClick', () => {
|
|
2039
|
+
const rowDoubleClick = jest.fn();
|
|
2040
|
+
|
|
2041
|
+
const data = [
|
|
2042
|
+
{ id: '1', name: 'First' },
|
|
2043
|
+
{ id: '2', name: 'Second' },
|
|
2044
|
+
{ id: '3', name: 'Third' },
|
|
2045
|
+
];
|
|
2046
|
+
const grid = new TekGrid({
|
|
2047
|
+
name: 'grid',
|
|
2048
|
+
component: 'TekGrid',
|
|
2049
|
+
columns: [
|
|
2050
|
+
{ name: 'id' },
|
|
2051
|
+
{ name: 'name' },
|
|
2052
|
+
],
|
|
2053
|
+
datasource: {
|
|
2054
|
+
data,
|
|
2055
|
+
},
|
|
2056
|
+
events: {
|
|
2057
|
+
rowDoubleClick,
|
|
2058
|
+
},
|
|
2059
|
+
});
|
|
2060
|
+
|
|
2061
|
+
const event = new Event('dblclick');
|
|
2062
|
+
const element = document.createElement('div');
|
|
2063
|
+
grid.rowDoubleClick(data[0], event, element);
|
|
2064
|
+
|
|
2065
|
+
expect(rowDoubleClick).toHaveBeenCalledWith({
|
|
2066
|
+
event,
|
|
2067
|
+
element,
|
|
2068
|
+
row: data[0],
|
|
2069
|
+
component: grid,
|
|
2070
|
+
});
|
|
2071
|
+
expect(grid.datasource.currentRow).toEqual(data[0]);
|
|
2072
|
+
});
|
|
2073
|
+
|
|
2074
|
+
it('should not call events.rowDoubleClick if preventRowDoubleClick is true', () => {
|
|
2075
|
+
const rowDoubleClick = jest.fn();
|
|
2076
|
+
const cellDoubleClickHandler = jest.fn(() => true);
|
|
2077
|
+
|
|
2078
|
+
const data = [
|
|
2079
|
+
{ id: '1', name: 'First' },
|
|
2080
|
+
{ id: '2', name: 'Second' },
|
|
2081
|
+
{ id: '3', name: 'Third' },
|
|
2082
|
+
];
|
|
2083
|
+
const grid = new TekGrid({
|
|
2084
|
+
name: 'grid',
|
|
2085
|
+
component: 'TekGrid',
|
|
2086
|
+
columns: [
|
|
2087
|
+
{ name: 'id' },
|
|
2088
|
+
{ name: 'name' },
|
|
2089
|
+
],
|
|
2090
|
+
datasource: {
|
|
2091
|
+
data,
|
|
2092
|
+
},
|
|
2093
|
+
events: {
|
|
2094
|
+
rowDoubleClick,
|
|
2095
|
+
cellDoubleClick: cellDoubleClickHandler,
|
|
2096
|
+
},
|
|
2097
|
+
});
|
|
2098
|
+
|
|
2099
|
+
const event = new Event('dblclick');
|
|
2100
|
+
const element = document.createElement('div');
|
|
2101
|
+
|
|
2102
|
+
grid.cellDoubleClick(grid.groupedData[0], grid.getColumn('id') as any, event, element);
|
|
2103
|
+
grid.rowDoubleClick(data[0], event, element);
|
|
2104
|
+
|
|
2105
|
+
expect(rowDoubleClick).not.toHaveBeenCalled();
|
|
2106
|
+
expect(grid.datasource.currentRow).toEqual({});
|
|
2107
|
+
});
|
|
2108
|
+
});
|
|
2109
|
+
|
|
2037
2110
|
describe('groupRowClick', () => {
|
|
2038
2111
|
it('groupRowClick method should call events.groupRowClick', async () => {
|
|
2039
2112
|
const groupRowClick = jest.fn();
|
|
@@ -2109,6 +2182,84 @@ describe('TekGrid', () => {
|
|
|
2109
2182
|
});
|
|
2110
2183
|
});
|
|
2111
2184
|
|
|
2185
|
+
describe('groupRowDoubleClick', () => {
|
|
2186
|
+
it('groupRowDoubleClick method should call events.groupRowDoubleClick', async () => {
|
|
2187
|
+
const groupRowDoubleClick = jest.fn();
|
|
2188
|
+
|
|
2189
|
+
const data = [
|
|
2190
|
+
{ id: '1', name: 'First', department: 1 },
|
|
2191
|
+
{ id: '2', name: 'Second', department: 1 },
|
|
2192
|
+
{ id: '3', name: 'Third', department: 1 },
|
|
2193
|
+
];
|
|
2194
|
+
const grid = new TekGrid({
|
|
2195
|
+
name: 'grid',
|
|
2196
|
+
component: 'TekGrid',
|
|
2197
|
+
columns: [
|
|
2198
|
+
{ name: 'id' },
|
|
2199
|
+
{ name: 'name' },
|
|
2200
|
+
{ name: 'department', grouped: true },
|
|
2201
|
+
],
|
|
2202
|
+
datasource: {
|
|
2203
|
+
data,
|
|
2204
|
+
},
|
|
2205
|
+
events: {
|
|
2206
|
+
groupRowDoubleClick,
|
|
2207
|
+
},
|
|
2208
|
+
});
|
|
2209
|
+
|
|
2210
|
+
await flushPromises();
|
|
2211
|
+
|
|
2212
|
+
const event = new Event('dblclick');
|
|
2213
|
+
const element = document.createElement('div');
|
|
2214
|
+
grid.groupRowDoubleClick(grid.groupedData[0], event, element);
|
|
2215
|
+
|
|
2216
|
+
expect(groupRowDoubleClick).toHaveBeenCalledWith({
|
|
2217
|
+
event,
|
|
2218
|
+
element,
|
|
2219
|
+
row: grid.groupedData[0],
|
|
2220
|
+
component: grid,
|
|
2221
|
+
});
|
|
2222
|
+
expect(grid.datasource.currentRow).toEqual({});
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
it('should not call events.groupRowDoubleClick if cellDoubleClick prevents it', async () => {
|
|
2226
|
+
const groupRowDoubleClick = jest.fn();
|
|
2227
|
+
const cellDoubleClickHandler = jest.fn(() => true);
|
|
2228
|
+
|
|
2229
|
+
const data = [
|
|
2230
|
+
{ id: '1', name: 'First', department: 1 },
|
|
2231
|
+
{ id: '2', name: 'Second', department: 1 },
|
|
2232
|
+
{ id: '3', name: 'Third', department: 1 },
|
|
2233
|
+
];
|
|
2234
|
+
const grid = new TekGrid({
|
|
2235
|
+
name: 'grid',
|
|
2236
|
+
component: 'TekGrid',
|
|
2237
|
+
columns: [
|
|
2238
|
+
{ name: 'id' },
|
|
2239
|
+
{ name: 'name' },
|
|
2240
|
+
{ name: 'department', grouped: true },
|
|
2241
|
+
],
|
|
2242
|
+
datasource: {
|
|
2243
|
+
data,
|
|
2244
|
+
},
|
|
2245
|
+
events: {
|
|
2246
|
+
groupRowDoubleClick,
|
|
2247
|
+
cellDoubleClick: cellDoubleClickHandler,
|
|
2248
|
+
},
|
|
2249
|
+
});
|
|
2250
|
+
|
|
2251
|
+
await flushPromises();
|
|
2252
|
+
|
|
2253
|
+
const event = new Event('dblclick');
|
|
2254
|
+
const element = document.createElement('div');
|
|
2255
|
+
|
|
2256
|
+
grid.cellDoubleClick(grid.groupedData[0], grid.getColumn('id') as any, event, element);
|
|
2257
|
+
grid.groupRowDoubleClick(grid.groupedData[0], event, element);
|
|
2258
|
+
|
|
2259
|
+
expect(groupRowDoubleClick).not.toHaveBeenCalled();
|
|
2260
|
+
});
|
|
2261
|
+
});
|
|
2262
|
+
|
|
2112
2263
|
describe('selectGroupClick', () => {
|
|
2113
2264
|
it('should trigger events', async () => {
|
|
2114
2265
|
const groupSelected = jest.fn();
|