@axinom/mosaic-ui 0.35.0-rc.7 → 0.35.0-rc.9
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/components/DynamicDataList/DynamicDataList.d.ts +5 -14
- package/dist/components/DynamicDataList/DynamicDataList.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.d.ts +3 -1
- package/dist/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListHeader/DynamicListHeader.d.ts +5 -1
- package/dist/components/DynamicDataList/DynamicListHeader/DynamicListHeader.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts +9 -10
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts.map +1 -1
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.d.ts +5 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.d.ts +4 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.d.ts +4 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.types.d.ts +38 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.types.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/index.d.ts +4 -0
- package/dist/components/DynamicDataList/helpers/DynamicListReducer/index.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/generateId.d.ts +6 -0
- package/dist/components/DynamicDataList/helpers/generateId.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/useColumnDefs.d.ts +14 -0
- package/dist/components/DynamicDataList/helpers/useColumnDefs.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/useDataHandler.d.ts +9 -0
- package/dist/components/DynamicDataList/helpers/useDataHandler.d.ts.map +1 -0
- package/dist/components/DynamicDataList/helpers/useRowAnimation.d.ts +12 -0
- package/dist/components/DynamicDataList/helpers/useRowAnimation.d.ts.map +1 -0
- package/dist/components/DynamicDataList/index.d.ts +1 -1
- package/dist/components/DynamicDataList/index.d.ts.map +1 -1
- package/dist/index.es.js +11 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/components/DynamicDataList/DynamicDataList.scss +0 -61
- package/src/components/DynamicDataList/DynamicDataList.spec.tsx +126 -393
- package/src/components/DynamicDataList/DynamicDataList.stories.tsx +0 -5
- package/src/components/DynamicDataList/DynamicDataList.tsx +133 -600
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.scss +4 -2
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.spec.tsx +17 -44
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.tsx +15 -22
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.scss +15 -10
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.spec.tsx +4 -1
- package/src/components/DynamicDataList/DynamicListHeader/DynamicListHeader.tsx +16 -14
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.scss +16 -24
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.spec.tsx +26 -253
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.tsx +45 -139
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.spec.ts +276 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.actions.ts +86 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.spec.ts +118 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.init.ts +40 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.spec.ts +89 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.ts +42 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/DynamicListReducer.types.ts +46 -0
- package/src/components/DynamicDataList/helpers/DynamicListReducer/index.ts +3 -0
- package/src/components/DynamicDataList/helpers/generateId.ts +10 -0
- package/src/components/DynamicDataList/helpers/useColumnDefs.ts +56 -0
- package/src/components/DynamicDataList/helpers/useDataHandler.ts +77 -0
- package/src/components/DynamicDataList/helpers/useRowAnimation.tsx +38 -0
- package/src/components/DynamicDataList/index.ts +2 -2
- package/src/components/DynamicDataList/DynamicDataList.reposition.spec.tsx +0 -816
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mount, shallow } from 'enzyme';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
3
|
import { Button } from '../../Buttons';
|
|
5
4
|
import { DynamicListColumn } from '../DynamicDataList.model';
|
|
6
5
|
import { DynamicListRow, DynamicListRowProps } from './DynamicListRow';
|
|
@@ -50,7 +49,6 @@ const defaultProps: DynamicListRowProps<DynamicListRowTestData> = {
|
|
|
50
49
|
positionKey: 'position',
|
|
51
50
|
horizontalTextAlign: 'left',
|
|
52
51
|
verticalTextAlign: 'center',
|
|
53
|
-
allowReordering: false,
|
|
54
52
|
allowRemove: false,
|
|
55
53
|
};
|
|
56
54
|
|
|
@@ -72,6 +70,7 @@ describe('DynamicListRow', () => {
|
|
|
72
70
|
<DynamicListRow
|
|
73
71
|
columns={defaultColumns}
|
|
74
72
|
columnSizes={defaultProps.columnSizes}
|
|
73
|
+
rowHeight={defaultProps.rowHeight}
|
|
75
74
|
data={defaultProps.data}
|
|
76
75
|
/>,
|
|
77
76
|
);
|
|
@@ -80,7 +79,10 @@ describe('DynamicListRow', () => {
|
|
|
80
79
|
|
|
81
80
|
expect(row.prop('style')).toHaveProperty('gridColumnGap', undefined);
|
|
82
81
|
expect(row.prop('style')).toHaveProperty('alignItems', undefined);
|
|
83
|
-
expect(row.prop('style')).toHaveProperty(
|
|
82
|
+
expect(row.prop('style')).toHaveProperty(
|
|
83
|
+
'gridAutoRows',
|
|
84
|
+
`minmax(50px, ${defaultProps.rowHeight})`,
|
|
85
|
+
);
|
|
84
86
|
expect(row.prop('style')).toHaveProperty(
|
|
85
87
|
'gridTemplateColumns',
|
|
86
88
|
defaultProps.columnSizes,
|
|
@@ -103,7 +105,7 @@ describe('DynamicListRow', () => {
|
|
|
103
105
|
);
|
|
104
106
|
expect(row.prop('style')).toHaveProperty(
|
|
105
107
|
'gridAutoRows',
|
|
106
|
-
defaultProps.rowHeight
|
|
108
|
+
`minmax(50px, ${defaultProps.rowHeight})`,
|
|
107
109
|
);
|
|
108
110
|
expect(row.prop('style')).toHaveProperty(
|
|
109
111
|
'gridTemplateColumns',
|
|
@@ -117,7 +119,11 @@ describe('DynamicListRow', () => {
|
|
|
117
119
|
|
|
118
120
|
it(`Button component should have type of 'button'`, () => {
|
|
119
121
|
const wrapper = mount(
|
|
120
|
-
<DynamicListRow
|
|
122
|
+
<DynamicListRow
|
|
123
|
+
{...defaultProps}
|
|
124
|
+
allowRemove={true}
|
|
125
|
+
showActionColumn={true}
|
|
126
|
+
/>,
|
|
121
127
|
);
|
|
122
128
|
|
|
123
129
|
const button = wrapper.find(Button);
|
|
@@ -137,7 +143,7 @@ describe('DynamicListRow', () => {
|
|
|
137
143
|
});
|
|
138
144
|
});
|
|
139
145
|
|
|
140
|
-
it(`renders the position column if
|
|
146
|
+
it(`renders the position column if 'showPositionColumn' is set to true`, () => {
|
|
141
147
|
const dataWithPosition: DynamicListRowTestData = {
|
|
142
148
|
id: 0,
|
|
143
149
|
desc: 'tes',
|
|
@@ -151,7 +157,7 @@ describe('DynamicListRow', () => {
|
|
|
151
157
|
columns={defaultColumns}
|
|
152
158
|
data={dataWithPosition}
|
|
153
159
|
positionKey={'position'}
|
|
154
|
-
|
|
160
|
+
showPositionColumn={true}
|
|
155
161
|
/>,
|
|
156
162
|
);
|
|
157
163
|
|
|
@@ -160,29 +166,7 @@ describe('DynamicListRow', () => {
|
|
|
160
166
|
expect(position.exists()).toBe(true);
|
|
161
167
|
});
|
|
162
168
|
|
|
163
|
-
it(`doesn't render the position column if
|
|
164
|
-
const dataWithPosition: DynamicListRowTestData = {
|
|
165
|
-
id: 0,
|
|
166
|
-
desc: 'tes',
|
|
167
|
-
title: 'a title',
|
|
168
|
-
position: 3,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const wrapper = shallow(
|
|
172
|
-
<DynamicListRow
|
|
173
|
-
columnSizes={''}
|
|
174
|
-
columns={defaultColumns}
|
|
175
|
-
data={dataWithPosition}
|
|
176
|
-
allowReordering={true}
|
|
177
|
-
/>,
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
const position = wrapper.find('.position');
|
|
181
|
-
|
|
182
|
-
expect(position.exists()).toBe(false);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it(`doesn't render the position column if 'allowReordering' is false`, () => {
|
|
169
|
+
it(`doesn't render the position column if 'showPositionColumn' is false`, () => {
|
|
186
170
|
const dataWithPosition: DynamicListRowTestData = {
|
|
187
171
|
id: 0,
|
|
188
172
|
desc: 'tes',
|
|
@@ -196,7 +180,7 @@ describe('DynamicListRow', () => {
|
|
|
196
180
|
columns={defaultColumns}
|
|
197
181
|
data={dataWithPosition}
|
|
198
182
|
positionKey={'position'}
|
|
199
|
-
|
|
183
|
+
showPositionColumn={false}
|
|
200
184
|
/>,
|
|
201
185
|
);
|
|
202
186
|
|
|
@@ -226,216 +210,39 @@ describe('DynamicListRow', () => {
|
|
|
226
210
|
expect(actualColumns.at(0).text()).toBe('Changed: title');
|
|
227
211
|
});
|
|
228
212
|
|
|
229
|
-
it(`
|
|
230
|
-
const dragSpy = jest.fn();
|
|
231
|
-
const propagateSpy = jest.fn();
|
|
232
|
-
const preventDefault = jest.fn();
|
|
233
|
-
const effectAllowedSpy = jest.fn();
|
|
234
|
-
const mockDragEvent = {
|
|
235
|
-
event: 'event',
|
|
236
|
-
stopPropagation: propagateSpy,
|
|
237
|
-
preventDefault: preventDefault,
|
|
238
|
-
dataTransfer: { effectAllowed: effectAllowedSpy },
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
const wrapper = shallow(
|
|
242
|
-
<DynamicListRow
|
|
243
|
-
columns={defaultColumns}
|
|
244
|
-
columnSizes={defaultProps.columnSizes}
|
|
245
|
-
data={dataWithPosition}
|
|
246
|
-
onDragStart={dragSpy}
|
|
247
|
-
positionKey={'position'}
|
|
248
|
-
/>,
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
let row = wrapper.find('.container');
|
|
252
|
-
|
|
253
|
-
expect(row.hasClass('dragging')).toBe(false);
|
|
254
|
-
|
|
255
|
-
wrapper.setProps({ dragging: true });
|
|
256
|
-
|
|
257
|
-
act(() => {
|
|
258
|
-
// @ts-expect-error not full event args object
|
|
259
|
-
row.prop('onDragStart')(mockDragEvent);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
wrapper.update();
|
|
263
|
-
|
|
264
|
-
row = wrapper.find('.container');
|
|
265
|
-
|
|
266
|
-
expect(dragSpy).toHaveBeenCalledTimes(1);
|
|
267
|
-
expect(dragSpy).toHaveBeenCalledWith(
|
|
268
|
-
mockDragEvent,
|
|
269
|
-
dataWithPosition.position,
|
|
270
|
-
);
|
|
271
|
-
expect(row.hasClass('dragging')).toBe(true);
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it(`doesn't allow dragging by default`, () => {
|
|
275
|
-
const wrapper = shallow(
|
|
276
|
-
<DynamicListRow
|
|
277
|
-
columns={defaultColumns}
|
|
278
|
-
columnSizes={defaultProps.columnSizes}
|
|
279
|
-
data={dataWithPosition}
|
|
280
|
-
positionKey={'position'}
|
|
281
|
-
/>,
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
const row = wrapper.find('.container');
|
|
285
|
-
|
|
286
|
-
expect(row.prop('draggable')).toBe(false);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it(`doesn't allow dragging if allowDragging is 'false'`, () => {
|
|
213
|
+
it(`doesn't allow dragging if showPositionColumn is 'false'`, () => {
|
|
290
214
|
const wrapper = shallow(
|
|
291
215
|
<DynamicListRow
|
|
292
216
|
columns={defaultColumns}
|
|
293
217
|
columnSizes={defaultProps.columnSizes}
|
|
294
218
|
data={dataWithPosition}
|
|
295
219
|
allowDragging={false}
|
|
296
|
-
|
|
220
|
+
showPositionColumn={true}
|
|
297
221
|
positionKey={'position'}
|
|
298
222
|
/>,
|
|
299
223
|
);
|
|
300
224
|
|
|
301
|
-
const row = wrapper.find('.container');
|
|
302
225
|
const dragIcon = wrapper.find('.draggable');
|
|
303
|
-
|
|
304
|
-
expect(row.prop('draggable')).toBe(false);
|
|
305
226
|
expect(dragIcon.exists()).toBe(false);
|
|
306
227
|
});
|
|
307
228
|
|
|
308
|
-
it(`
|
|
229
|
+
it(`only allows dragging if both showPositionColumn and allowDragging are 'true'`, () => {
|
|
309
230
|
const wrapper = shallow(
|
|
310
231
|
<DynamicListRow
|
|
311
232
|
columns={defaultColumns}
|
|
312
233
|
columnSizes={defaultProps.columnSizes}
|
|
313
234
|
data={dataWithPosition}
|
|
314
235
|
allowDragging={true}
|
|
315
|
-
|
|
236
|
+
showPositionColumn={true}
|
|
316
237
|
positionKey={'position'}
|
|
317
238
|
/>,
|
|
318
239
|
);
|
|
319
240
|
|
|
320
|
-
const row = wrapper.find('.container');
|
|
321
241
|
const dragIcon = wrapper.find('.draggable');
|
|
322
242
|
|
|
323
|
-
expect(row.prop('draggable')).toBe(false);
|
|
324
|
-
expect(dragIcon.exists()).toBe(false);
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
it(`only allows dragging if both allowReordering and allowDragging are 'true'`, () => {
|
|
328
|
-
const wrapper = shallow(
|
|
329
|
-
<DynamicListRow
|
|
330
|
-
columns={defaultColumns}
|
|
331
|
-
columnSizes={defaultProps.columnSizes}
|
|
332
|
-
data={dataWithPosition}
|
|
333
|
-
allowDragging={true}
|
|
334
|
-
allowReordering={true}
|
|
335
|
-
positionKey={'position'}
|
|
336
|
-
/>,
|
|
337
|
-
);
|
|
338
|
-
|
|
339
|
-
const row = wrapper.find('.container');
|
|
340
|
-
const dragIcon = wrapper.find('.draggable');
|
|
341
|
-
|
|
342
|
-
expect(row.prop('draggable')).toBe(true);
|
|
343
243
|
expect(dragIcon.exists()).toBe(true);
|
|
344
244
|
});
|
|
345
245
|
|
|
346
|
-
it(`emits onDragEnd with event and removes 'dragging' class`, () => {
|
|
347
|
-
const dragSpy = jest.fn();
|
|
348
|
-
const propagateSpy = jest.fn();
|
|
349
|
-
const preventDefault = jest.fn();
|
|
350
|
-
const effectAllowedSpy = jest.fn();
|
|
351
|
-
const mockDragEvent = {
|
|
352
|
-
event: 'event',
|
|
353
|
-
stopPropagation: propagateSpy,
|
|
354
|
-
preventDefault: preventDefault,
|
|
355
|
-
dataTransfer: { effectAllowed: effectAllowedSpy },
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const wrapper = shallow(
|
|
359
|
-
<DynamicListRow
|
|
360
|
-
columns={defaultColumns}
|
|
361
|
-
columnSizes={defaultProps.columnSizes}
|
|
362
|
-
data={defaultProps.data}
|
|
363
|
-
onDragEnd={dragSpy}
|
|
364
|
-
dragging={true}
|
|
365
|
-
/>,
|
|
366
|
-
);
|
|
367
|
-
|
|
368
|
-
let row = wrapper.find('.container');
|
|
369
|
-
|
|
370
|
-
act(() => {
|
|
371
|
-
// @ts-expect-error not full event args object
|
|
372
|
-
row.prop('onDragStart')(mockDragEvent);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
wrapper.update();
|
|
376
|
-
|
|
377
|
-
row = wrapper.find('.container');
|
|
378
|
-
|
|
379
|
-
expect(row.hasClass('dragging')).toBe(true);
|
|
380
|
-
|
|
381
|
-
wrapper.setProps({ dragging: false });
|
|
382
|
-
|
|
383
|
-
act(() => {
|
|
384
|
-
// @ts-expect-error not full event args object
|
|
385
|
-
row.prop('onDragEnd')(mockDragEvent);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
row = wrapper.find('.container');
|
|
389
|
-
|
|
390
|
-
expect(dragSpy).toHaveBeenCalledTimes(1);
|
|
391
|
-
expect(dragSpy).toHaveBeenCalledWith(mockDragEvent);
|
|
392
|
-
expect(row.hasClass('dragging')).toBe(false);
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// TODO: figure out how to mock getBoundingClientRect
|
|
396
|
-
// it(`adds 'draggedAbove' or 'draggedBelow' class when a dragged element enters the drop zone`, () => {
|
|
397
|
-
// const propagateSpy = jest.fn();
|
|
398
|
-
// const preventDefaultSpy = jest.fn();
|
|
399
|
-
// const dropEffectSpy = jest.fn();
|
|
400
|
-
// const getBoundingClientRectSpy = jest.fn(() => ({ top: 100, height: 150 }));
|
|
401
|
-
// const mockDragEvent = {
|
|
402
|
-
// event: {
|
|
403
|
-
// currentTarget: { getBoundingClientRect: getBoundingClientRectSpy },
|
|
404
|
-
// },
|
|
405
|
-
// stopPropagation: propagateSpy,
|
|
406
|
-
// preventDefault: preventDefaultSpy,
|
|
407
|
-
// dataTransfer: { dropEffect: dropEffectSpy },
|
|
408
|
-
// };
|
|
409
|
-
|
|
410
|
-
// const wrapper = shallow(
|
|
411
|
-
// <DynamicListRow
|
|
412
|
-
// columns={defaultColumns}
|
|
413
|
-
// columnSizes={defaultProps.columnSizes}
|
|
414
|
-
// data={dataWithPosition}
|
|
415
|
-
// positionKey={'position'}
|
|
416
|
-
// />,
|
|
417
|
-
// );
|
|
418
|
-
|
|
419
|
-
// let row = wrapper.find('.container');
|
|
420
|
-
|
|
421
|
-
// expect(row.hasClass('draggedAbove')).toBe(false);
|
|
422
|
-
|
|
423
|
-
// act(() => {
|
|
424
|
-
// // @ts-ignore
|
|
425
|
-
// row.prop('onDragOver')(mockDragEvent);
|
|
426
|
-
// });
|
|
427
|
-
|
|
428
|
-
// wrapper.update();
|
|
429
|
-
|
|
430
|
-
// console.log(wrapper.debug());
|
|
431
|
-
|
|
432
|
-
// row = wrapper.find('.container');
|
|
433
|
-
|
|
434
|
-
// expect(row.hasClass('draggedAbove')).toBe(true);
|
|
435
|
-
// });
|
|
436
|
-
|
|
437
|
-
it.todo(`onDrop removes 'draggedAbove' or 'draggedBelow'`);
|
|
438
|
-
|
|
439
246
|
it(`doesn't display an action button by default`, () => {
|
|
440
247
|
const wrapper = shallow(
|
|
441
248
|
<DynamicListRow
|
|
@@ -450,13 +257,14 @@ describe('DynamicListRow', () => {
|
|
|
450
257
|
expect(button.exists()).toBe(false);
|
|
451
258
|
});
|
|
452
259
|
|
|
453
|
-
it(`displays an action button if '
|
|
260
|
+
it(`displays an action button if 'showActionColumn' is set to true`, () => {
|
|
454
261
|
const wrapper = shallow(
|
|
455
262
|
<DynamicListRow
|
|
456
263
|
columns={defaultColumns}
|
|
457
264
|
columnSizes={defaultProps.columnSizes}
|
|
458
265
|
data={defaultProps.data}
|
|
459
266
|
allowRemove={true}
|
|
267
|
+
showActionColumn={true}
|
|
460
268
|
/>,
|
|
461
269
|
);
|
|
462
270
|
|
|
@@ -474,6 +282,7 @@ describe('DynamicListRow', () => {
|
|
|
474
282
|
data={defaultProps.data}
|
|
475
283
|
allowRemove={true}
|
|
476
284
|
onActionClicked={spy}
|
|
285
|
+
showActionColumn={true}
|
|
477
286
|
/>,
|
|
478
287
|
);
|
|
479
288
|
|
|
@@ -485,27 +294,6 @@ describe('DynamicListRow', () => {
|
|
|
485
294
|
expect(spy).toHaveBeenCalledWith(defaultData);
|
|
486
295
|
});
|
|
487
296
|
|
|
488
|
-
it(`input width and height should be the same as the 'rowHeight' prop if its set`, () => {
|
|
489
|
-
const mockHeight = '70px';
|
|
490
|
-
const wrapper = mount(
|
|
491
|
-
<DynamicListRow
|
|
492
|
-
columns={defaultColumns}
|
|
493
|
-
columnSizes={defaultProps.columnSizes}
|
|
494
|
-
data={dataWithPosition}
|
|
495
|
-
positionKey={'position'}
|
|
496
|
-
allowReordering={true}
|
|
497
|
-
rowHeight={mockHeight}
|
|
498
|
-
/>,
|
|
499
|
-
);
|
|
500
|
-
|
|
501
|
-
const inputStyles = wrapper
|
|
502
|
-
.find('input')
|
|
503
|
-
.prop('style') as React.CSSProperties;
|
|
504
|
-
|
|
505
|
-
expect(inputStyles.height).toBe(mockHeight);
|
|
506
|
-
expect(inputStyles.width).toBe(mockHeight);
|
|
507
|
-
});
|
|
508
|
-
|
|
509
297
|
it('emits onPositionInputChanged with the current position and the new target position', () => {
|
|
510
298
|
const inputSpy = jest.fn();
|
|
511
299
|
const mockNewPosition = '9';
|
|
@@ -516,7 +304,7 @@ describe('DynamicListRow', () => {
|
|
|
516
304
|
data={dataWithPosition}
|
|
517
305
|
onPositionInputChanged={inputSpy}
|
|
518
306
|
positionKey={'position'}
|
|
519
|
-
|
|
307
|
+
showPositionColumn={true}
|
|
520
308
|
/>,
|
|
521
309
|
);
|
|
522
310
|
|
|
@@ -544,7 +332,7 @@ describe('DynamicListRow', () => {
|
|
|
544
332
|
data={dataWithPosition}
|
|
545
333
|
onPositionInputChanged={inputSpy}
|
|
546
334
|
positionKey={'position'}
|
|
547
|
-
|
|
335
|
+
showPositionColumn={true}
|
|
548
336
|
/>,
|
|
549
337
|
);
|
|
550
338
|
|
|
@@ -566,7 +354,7 @@ describe('DynamicListRow', () => {
|
|
|
566
354
|
columnSizes={defaultProps.columnSizes}
|
|
567
355
|
data={dataWithPosition}
|
|
568
356
|
positionKey={'position'}
|
|
569
|
-
|
|
357
|
+
showPositionColumn={true}
|
|
570
358
|
/>,
|
|
571
359
|
);
|
|
572
360
|
|
|
@@ -591,7 +379,7 @@ describe('DynamicListRow', () => {
|
|
|
591
379
|
columnSizes={defaultProps.columnSizes}
|
|
592
380
|
data={dataWithPosition}
|
|
593
381
|
positionKey={'position'}
|
|
594
|
-
|
|
382
|
+
showPositionColumn={true}
|
|
595
383
|
/>,
|
|
596
384
|
);
|
|
597
385
|
|
|
@@ -608,21 +396,6 @@ describe('DynamicListRow', () => {
|
|
|
608
396
|
expect(input.prop('value')).toBe(dataWithPosition.position);
|
|
609
397
|
});
|
|
610
398
|
|
|
611
|
-
it('disables pointer events while a row is being repositioned', () => {
|
|
612
|
-
const wrapper = shallow(
|
|
613
|
-
<DynamicListRow
|
|
614
|
-
columns={defaultColumns}
|
|
615
|
-
columnSizes={defaultProps.columnSizes}
|
|
616
|
-
data={defaultProps.data}
|
|
617
|
-
dragging={true}
|
|
618
|
-
/>,
|
|
619
|
-
);
|
|
620
|
-
|
|
621
|
-
const row = wrapper.find('.container');
|
|
622
|
-
|
|
623
|
-
expect(row.hasClass('dragging')).toBe(true);
|
|
624
|
-
});
|
|
625
|
-
|
|
626
399
|
describe('tooltip', () => {
|
|
627
400
|
it(`renders a tooltip using the 'title' html attribute by default`, () => {
|
|
628
401
|
const wrapper = shallow(
|