@pingux/astro 2.206.2-alpha.0 → 2.207.0-alpha.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/lib/cjs/components/Button/Buttons.styles.d.ts +14 -0
- package/lib/cjs/components/Button/Buttons.styles.js +11 -1
- package/lib/cjs/components/TableBase/TableBase.js +138 -32
- package/lib/cjs/components/TableBase/TableBase.mdx +46 -13
- package/lib/cjs/components/TableBase/TableBase.stories.js +52 -2
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +84 -9
- package/lib/cjs/components/TableBase/TableBase.styles.js +61 -10
- package/lib/cjs/components/TableBase/TableBase.test.js +585 -105
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +14 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +16 -2
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +10 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +7 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +4 -1
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +3 -0
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +6 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +3 -0
- package/lib/cjs/types/tableBase.d.ts +21 -5
- package/lib/components/Button/Buttons.styles.js +11 -1
- package/lib/components/TableBase/TableBase.js +139 -33
- package/lib/components/TableBase/TableBase.mdx +46 -13
- package/lib/components/TableBase/TableBase.stories.js +51 -1
- package/lib/components/TableBase/TableBase.styles.js +61 -10
- package/lib/components/TableBase/TableBase.test.js +585 -105
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +16 -2
- package/lib/styles/themes/next-gen/variants/button.js +4 -1
- package/lib/styles/themes/next-gen/variants/tableBase.js +6 -1
- package/package.json +1 -1
|
@@ -21,12 +21,14 @@ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present,
|
|
|
21
21
|
function _regeneratorDefine2(e, r, n, t) { var i = _Object$defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
22
22
|
function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
23
23
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
24
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
24
25
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
|
25
26
|
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
26
27
|
import React from 'react';
|
|
27
28
|
import { useAsyncList } from 'react-stately';
|
|
28
29
|
import { act as actHooks, fireEvent, render, renderHook, screen, within } from '@testing-library/react';
|
|
29
30
|
import userEvent from '@testing-library/user-event';
|
|
31
|
+
import { axe } from 'jest-axe';
|
|
30
32
|
import { Cell, Column, Row, TBody, THead } from '../../index';
|
|
31
33
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
32
34
|
import TableBase from './TableBase';
|
|
@@ -86,8 +88,6 @@ var getComponent = function getComponent() {
|
|
|
86
88
|
});
|
|
87
89
|
})));
|
|
88
90
|
};
|
|
89
|
-
|
|
90
|
-
// Needs to be added to each components test file
|
|
91
91
|
universalComponentTests({
|
|
92
92
|
renderComponent: function renderComponent(props) {
|
|
93
93
|
return ___EmotionJSX(TableBase, _extends({}, defaultProps, props), ___EmotionJSX(THead, {
|
|
@@ -169,26 +169,205 @@ test('should change selection on mouse press', /*#__PURE__*/_asyncToGenerator(/*
|
|
|
169
169
|
}
|
|
170
170
|
}, _callee);
|
|
171
171
|
})));
|
|
172
|
+
test('should NOT change selection on row body click when hasSelectionCheckboxes is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
173
|
+
var rows, firstBodyRowCells;
|
|
174
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
175
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
getComponent({
|
|
178
|
+
selectionMode: 'multiple',
|
|
179
|
+
hasSelectionCheckboxes: true
|
|
180
|
+
});
|
|
181
|
+
rows = screen.getAllByRole('row'); // Click on a cell (the actual user target) — cell-level stopPropagation prevents
|
|
182
|
+
// the row's press handler from firing, so no selection is triggered.
|
|
183
|
+
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
184
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
185
|
+
_context2.next = 6;
|
|
186
|
+
return userEvent.click(firstBodyRowCells[1]);
|
|
187
|
+
case 6:
|
|
188
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
189
|
+
case 7:
|
|
190
|
+
case "end":
|
|
191
|
+
return _context2.stop();
|
|
192
|
+
}
|
|
193
|
+
}, _callee2);
|
|
194
|
+
})));
|
|
195
|
+
test('should change selection via checkbox when hasSelectionCheckboxes is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
196
|
+
var rows, firstRowCheckbox;
|
|
197
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
198
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
getComponent({
|
|
201
|
+
selectionMode: 'multiple',
|
|
202
|
+
hasSelectionCheckboxes: true
|
|
203
|
+
});
|
|
204
|
+
rows = screen.getAllByRole('row');
|
|
205
|
+
firstRowCheckbox = within(rows[1]).getByRole('checkbox');
|
|
206
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
207
|
+
_context3.next = 6;
|
|
208
|
+
return userEvent.click(firstRowCheckbox);
|
|
209
|
+
case 6:
|
|
210
|
+
expect(rows[1]).toHaveClass('is-selected');
|
|
211
|
+
case 7:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context3.stop();
|
|
214
|
+
}
|
|
215
|
+
}, _callee3);
|
|
216
|
+
})));
|
|
217
|
+
test('mousedown on a cell does not bubble to row via React synthetic event', function () {
|
|
218
|
+
// Verify that the cell-level stopPropagation approach prevents the row's React
|
|
219
|
+
// onMouseDown handler from firing. We test this with a simple isolated component
|
|
220
|
+
// that matches the structure used in TableCell (mergeProps with stopPropagation).
|
|
221
|
+
// The full integration is covered by the hasSelectionCheckboxes test above.
|
|
222
|
+
var rowSpy = jest.fn();
|
|
223
|
+
render(___EmotionJSX("table", null, ___EmotionJSX("tbody", null, ___EmotionJSX("tr", {
|
|
224
|
+
"data-testid": "test-row",
|
|
225
|
+
onMouseDown: rowSpy
|
|
226
|
+
}, ___EmotionJSX("td", {
|
|
227
|
+
"data-testid": "test-cell",
|
|
228
|
+
onMouseDown: function onMouseDown(e) {
|
|
229
|
+
return e.stopPropagation();
|
|
230
|
+
}
|
|
231
|
+
}, "cell content")))));
|
|
232
|
+
fireEvent.mouseDown(screen.getByTestId('test-cell'));
|
|
233
|
+
// The row's React onMouseDown should not have fired because stopPropagation
|
|
234
|
+
// was called on the td's synthetic onMouseDown handler.
|
|
235
|
+
expect(rowSpy).not.toHaveBeenCalled();
|
|
236
|
+
});
|
|
237
|
+
test('should toggle selection on Enter key when row is focused', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
238
|
+
var rows;
|
|
239
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
240
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
241
|
+
case 0:
|
|
242
|
+
getComponent({
|
|
243
|
+
selectionMode: 'multiple'
|
|
244
|
+
});
|
|
245
|
+
rows = screen.getAllByRole('row');
|
|
246
|
+
_context4.next = 4;
|
|
247
|
+
return userEvent.tab();
|
|
248
|
+
case 4:
|
|
249
|
+
expect(rows[1]).toHaveFocus();
|
|
250
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
251
|
+
fireEvent.keyDown(rows[1], {
|
|
252
|
+
key: 'Enter'
|
|
253
|
+
});
|
|
254
|
+
expect(rows[1]).toHaveClass('is-selected');
|
|
255
|
+
fireEvent.keyDown(rows[1], {
|
|
256
|
+
key: 'Enter'
|
|
257
|
+
});
|
|
258
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
259
|
+
case 10:
|
|
260
|
+
case "end":
|
|
261
|
+
return _context4.stop();
|
|
262
|
+
}
|
|
263
|
+
}, _callee4);
|
|
264
|
+
})));
|
|
265
|
+
test('Enter key should toggle selection on focused row with checkboxes', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
266
|
+
var rows;
|
|
267
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
268
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
269
|
+
case 0:
|
|
270
|
+
getComponent({
|
|
271
|
+
selectionMode: 'multiple'
|
|
272
|
+
});
|
|
273
|
+
rows = screen.getAllByRole('row');
|
|
274
|
+
_context5.next = 4;
|
|
275
|
+
return userEvent.tab();
|
|
276
|
+
case 4:
|
|
277
|
+
expect(rows[1]).toHaveFocus();
|
|
278
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
279
|
+
fireEvent.keyDown(rows[1], {
|
|
280
|
+
key: 'Enter'
|
|
281
|
+
});
|
|
282
|
+
expect(rows[1]).toHaveClass('is-selected');
|
|
283
|
+
case 8:
|
|
284
|
+
case "end":
|
|
285
|
+
return _context5.stop();
|
|
286
|
+
}
|
|
287
|
+
}, _callee5);
|
|
288
|
+
})));
|
|
289
|
+
test('Enter key should not change selection when selectionMode is none', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
290
|
+
var rows;
|
|
291
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
292
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
293
|
+
case 0:
|
|
294
|
+
getComponent();
|
|
295
|
+
rows = screen.getAllByRole('row');
|
|
296
|
+
_context6.next = 4;
|
|
297
|
+
return userEvent.tab();
|
|
298
|
+
case 4:
|
|
299
|
+
expect(rows[1]).toHaveFocus();
|
|
300
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
301
|
+
fireEvent.keyDown(rows[1], {
|
|
302
|
+
key: 'Enter'
|
|
303
|
+
});
|
|
304
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
305
|
+
case 8:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context6.stop();
|
|
308
|
+
}
|
|
309
|
+
}, _callee6);
|
|
310
|
+
})));
|
|
311
|
+
test('Enter key should toggle a row checkbox when the checkbox input is focused', function () {
|
|
312
|
+
getComponent({
|
|
313
|
+
selectionMode: 'multiple'
|
|
314
|
+
});
|
|
315
|
+
var rows = screen.getAllByRole('row');
|
|
316
|
+
var checkboxes = screen.getAllByRole('checkbox');
|
|
317
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
318
|
+
// focus() triggers React Aria focus state updates and must be wrapped in act
|
|
319
|
+
actHooks(function () {
|
|
320
|
+
checkboxes[1].focus();
|
|
321
|
+
});
|
|
322
|
+
fireEvent.keyDown(checkboxes[1], {
|
|
323
|
+
key: 'Enter'
|
|
324
|
+
});
|
|
325
|
+
expect(rows[1]).toHaveClass('is-selected');
|
|
326
|
+
fireEvent.keyDown(checkboxes[1], {
|
|
327
|
+
key: 'Enter'
|
|
328
|
+
});
|
|
329
|
+
expect(rows[1]).not.toHaveClass('is-selected');
|
|
330
|
+
});
|
|
331
|
+
test('Enter key should toggle select-all checkbox when it is focused', function () {
|
|
332
|
+
var _context7, _context8;
|
|
333
|
+
getComponent({
|
|
334
|
+
selectionMode: 'multiple'
|
|
335
|
+
});
|
|
336
|
+
var rows = screen.getAllByRole('row');
|
|
337
|
+
var selectAllCheckbox = screen.getByTestId('select-all-checkbox');
|
|
338
|
+
_forEachInstanceProperty(_context7 = _sliceInstanceProperty(rows).call(rows, 1)).call(_context7, function (row) {
|
|
339
|
+
return expect(row).not.toHaveClass('is-selected');
|
|
340
|
+
});
|
|
341
|
+
actHooks(function () {
|
|
342
|
+
selectAllCheckbox.focus();
|
|
343
|
+
});
|
|
344
|
+
fireEvent.keyDown(selectAllCheckbox, {
|
|
345
|
+
key: 'Enter'
|
|
346
|
+
});
|
|
347
|
+
_forEachInstanceProperty(_context8 = _sliceInstanceProperty(rows).call(rows, 1)).call(_context8, function (row) {
|
|
348
|
+
return expect(row).toHaveClass('is-selected');
|
|
349
|
+
});
|
|
350
|
+
});
|
|
172
351
|
test('should change select all checkbox on mouse press', function () {
|
|
173
352
|
getComponent({
|
|
174
353
|
selectionMode: 'multiple'
|
|
175
354
|
});
|
|
176
355
|
var rows = screen.getAllByRole('row');
|
|
177
356
|
_forEachInstanceProperty(rows).call(rows, /*#__PURE__*/function () {
|
|
178
|
-
var
|
|
179
|
-
return _regeneratorRuntime().wrap(function
|
|
180
|
-
while (1) switch (
|
|
357
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(element) {
|
|
358
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context9) {
|
|
359
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
181
360
|
case 0:
|
|
182
|
-
|
|
361
|
+
_context9.next = 2;
|
|
183
362
|
return userEvent.click(element);
|
|
184
363
|
case 2:
|
|
185
364
|
case "end":
|
|
186
|
-
return
|
|
365
|
+
return _context9.stop();
|
|
187
366
|
}
|
|
188
|
-
},
|
|
367
|
+
}, _callee7);
|
|
189
368
|
}));
|
|
190
369
|
return function (_x) {
|
|
191
|
-
return
|
|
370
|
+
return _ref7.apply(this, arguments);
|
|
192
371
|
};
|
|
193
372
|
}());
|
|
194
373
|
var headerCheckbox = screen.getByTestId('select-all-checkbox');
|
|
@@ -210,31 +389,31 @@ test('should checked checkboxes if selected keys are provided', function () {
|
|
|
210
389
|
var headerCheckbox = screen.getByTestId('select-all-checkbox');
|
|
211
390
|
expect(headerCheckbox).toBePartiallyChecked();
|
|
212
391
|
});
|
|
213
|
-
test('tab key should focus on the first cell of the first row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
392
|
+
test('tab key should focus on the first cell of the first row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
214
393
|
var rows;
|
|
215
|
-
return _regeneratorRuntime().wrap(function
|
|
216
|
-
while (1) switch (
|
|
394
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context0) {
|
|
395
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
217
396
|
case 0:
|
|
218
397
|
getComponent();
|
|
219
398
|
rows = screen.getAllByRole('row');
|
|
220
|
-
|
|
399
|
+
_context0.next = 4;
|
|
221
400
|
return userEvent.tab();
|
|
222
401
|
case 4:
|
|
223
402
|
expect(rows[1]).toHaveFocus();
|
|
224
403
|
case 5:
|
|
225
404
|
case "end":
|
|
226
|
-
return
|
|
405
|
+
return _context0.stop();
|
|
227
406
|
}
|
|
228
|
-
},
|
|
407
|
+
}, _callee8);
|
|
229
408
|
})));
|
|
230
|
-
test('Arrow Down key should focus the next row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
409
|
+
test('Arrow Down key should focus the next row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
231
410
|
var rows;
|
|
232
|
-
return _regeneratorRuntime().wrap(function
|
|
233
|
-
while (1) switch (
|
|
411
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context1) {
|
|
412
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
234
413
|
case 0:
|
|
235
414
|
getComponent();
|
|
236
415
|
rows = screen.getAllByRole('row');
|
|
237
|
-
|
|
416
|
+
_context1.next = 4;
|
|
238
417
|
return userEvent.tab();
|
|
239
418
|
case 4:
|
|
240
419
|
expect(rows[1]).toHaveFocus();
|
|
@@ -254,18 +433,18 @@ test('Arrow Down key should focus the next row', /*#__PURE__*/_asyncToGenerator(
|
|
|
254
433
|
expect(rows[3]).toHaveFocus();
|
|
255
434
|
case 11:
|
|
256
435
|
case "end":
|
|
257
|
-
return
|
|
436
|
+
return _context1.stop();
|
|
258
437
|
}
|
|
259
|
-
},
|
|
438
|
+
}, _callee9);
|
|
260
439
|
})));
|
|
261
|
-
test('Arrow Up key should focus the next row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
440
|
+
test('Arrow Up key should focus the next row', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0() {
|
|
262
441
|
var rows, columnheader;
|
|
263
|
-
return _regeneratorRuntime().wrap(function
|
|
264
|
-
while (1) switch (
|
|
442
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context10) {
|
|
443
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
265
444
|
case 0:
|
|
266
445
|
getComponent();
|
|
267
446
|
rows = screen.getAllByRole('row');
|
|
268
|
-
|
|
447
|
+
_context10.next = 4;
|
|
269
448
|
return userEvent.tab();
|
|
270
449
|
case 4:
|
|
271
450
|
expect(rows[1]).toHaveFocus();
|
|
@@ -279,20 +458,20 @@ test('Arrow Up key should focus the next row', /*#__PURE__*/_asyncToGenerator(/*
|
|
|
279
458
|
expect(columnheader[0]).toHaveFocus();
|
|
280
459
|
case 9:
|
|
281
460
|
case "end":
|
|
282
|
-
return
|
|
461
|
+
return _context10.stop();
|
|
283
462
|
}
|
|
284
|
-
},
|
|
463
|
+
}, _callee0);
|
|
285
464
|
})));
|
|
286
|
-
test('Arrow Right move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
465
|
+
test('Arrow Right move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1() {
|
|
287
466
|
var rows, firstRow, tableCells;
|
|
288
|
-
return _regeneratorRuntime().wrap(function
|
|
289
|
-
while (1) switch (
|
|
467
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context11) {
|
|
468
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
290
469
|
case 0:
|
|
291
470
|
getComponent();
|
|
292
471
|
rows = screen.getAllByRole('row');
|
|
293
472
|
firstRow = screen.getAllByRole('row')[1];
|
|
294
473
|
tableCells = firstRow.querySelectorAll('td');
|
|
295
|
-
|
|
474
|
+
_context11.next = 6;
|
|
296
475
|
return userEvent.tab();
|
|
297
476
|
case 6:
|
|
298
477
|
expect(rows[1]).toHaveFocus();
|
|
@@ -326,20 +505,20 @@ test('Arrow Right move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/
|
|
|
326
505
|
expect(rows[1]).toHaveFocus();
|
|
327
506
|
case 19:
|
|
328
507
|
case "end":
|
|
329
|
-
return
|
|
508
|
+
return _context11.stop();
|
|
330
509
|
}
|
|
331
|
-
},
|
|
510
|
+
}, _callee1);
|
|
332
511
|
})));
|
|
333
|
-
test('Arrow Left move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
512
|
+
test('Arrow Left move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
334
513
|
var rows, firstRow, tableCells;
|
|
335
|
-
return _regeneratorRuntime().wrap(function
|
|
336
|
-
while (1) switch (
|
|
514
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context12) {
|
|
515
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
337
516
|
case 0:
|
|
338
517
|
getComponent();
|
|
339
518
|
rows = screen.getAllByRole('row');
|
|
340
519
|
firstRow = screen.getAllByRole('row')[1];
|
|
341
520
|
tableCells = firstRow.querySelectorAll('td');
|
|
342
|
-
|
|
521
|
+
_context12.next = 6;
|
|
343
522
|
return userEvent.tab();
|
|
344
523
|
case 6:
|
|
345
524
|
expect(rows[1]).toHaveFocus();
|
|
@@ -373,10 +552,311 @@ test('Arrow Left move the focus to next cell', /*#__PURE__*/_asyncToGenerator(/*
|
|
|
373
552
|
expect(rows[1]).toHaveFocus();
|
|
374
553
|
case 19:
|
|
375
554
|
case "end":
|
|
376
|
-
return
|
|
555
|
+
return _context12.stop();
|
|
377
556
|
}
|
|
378
|
-
},
|
|
557
|
+
}, _callee10);
|
|
379
558
|
})));
|
|
559
|
+
describe('Resizable columns', function () {
|
|
560
|
+
var resizableHeaders = [{
|
|
561
|
+
key: 'name',
|
|
562
|
+
name: 'Name'
|
|
563
|
+
}, {
|
|
564
|
+
key: 'value',
|
|
565
|
+
name: 'Value'
|
|
566
|
+
}];
|
|
567
|
+
var resizableObjects = [{
|
|
568
|
+
key: '1',
|
|
569
|
+
name: 'Alpha',
|
|
570
|
+
value: '10'
|
|
571
|
+
}, {
|
|
572
|
+
key: '2',
|
|
573
|
+
name: 'Beta',
|
|
574
|
+
value: '20'
|
|
575
|
+
}];
|
|
576
|
+
test('renders resize slider input for a resizable column', function () {
|
|
577
|
+
render(___EmotionJSX(TableBase, {
|
|
578
|
+
"aria-label": "resizable table"
|
|
579
|
+
}, ___EmotionJSX(THead, {
|
|
580
|
+
columns: resizableHeaders
|
|
581
|
+
}, function (head) {
|
|
582
|
+
return ___EmotionJSX(Column, {
|
|
583
|
+
key: head.key,
|
|
584
|
+
allowsResizing: true
|
|
585
|
+
}, head.name);
|
|
586
|
+
}), ___EmotionJSX(TBody, {
|
|
587
|
+
items: resizableObjects
|
|
588
|
+
}, function (row) {
|
|
589
|
+
return ___EmotionJSX(Row, {
|
|
590
|
+
key: row.key
|
|
591
|
+
}, function (columnKey) {
|
|
592
|
+
return ___EmotionJSX(Cell, null, row[columnKey]);
|
|
593
|
+
});
|
|
594
|
+
})));
|
|
595
|
+
|
|
596
|
+
// Each resizable column renders a visually-hidden <input type="range">
|
|
597
|
+
// accessible as role="slider" with an aria-label containing the column name
|
|
598
|
+
var slider = screen.getByRole('slider', {
|
|
599
|
+
name: /Name column width/i
|
|
600
|
+
});
|
|
601
|
+
expect(slider).toBeInTheDocument();
|
|
602
|
+
expect(screen.getByRole('slider', {
|
|
603
|
+
name: /Value column width/i
|
|
604
|
+
})).toBeInTheDocument();
|
|
605
|
+
});
|
|
606
|
+
test('resizable table has no accessibility violations', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
607
|
+
var _render, container, results;
|
|
608
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context13) {
|
|
609
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
610
|
+
case 0:
|
|
611
|
+
jest.useRealTimers();
|
|
612
|
+
_render = render(___EmotionJSX(TableBase, {
|
|
613
|
+
"aria-label": "resizable table"
|
|
614
|
+
}, ___EmotionJSX(THead, {
|
|
615
|
+
columns: resizableHeaders
|
|
616
|
+
}, function (head) {
|
|
617
|
+
return ___EmotionJSX(Column, {
|
|
618
|
+
key: head.key,
|
|
619
|
+
allowsResizing: true
|
|
620
|
+
}, head.name);
|
|
621
|
+
}), ___EmotionJSX(TBody, {
|
|
622
|
+
items: resizableObjects
|
|
623
|
+
}, function (row) {
|
|
624
|
+
return ___EmotionJSX(Row, {
|
|
625
|
+
key: row.key
|
|
626
|
+
}, function (columnKey) {
|
|
627
|
+
return ___EmotionJSX(Cell, null, row[columnKey]);
|
|
628
|
+
});
|
|
629
|
+
}))), container = _render.container;
|
|
630
|
+
_context13.next = 4;
|
|
631
|
+
return axe(container);
|
|
632
|
+
case 4:
|
|
633
|
+
results = _context13.sent;
|
|
634
|
+
jest.useFakeTimers();
|
|
635
|
+
expect(results).toHaveNoViolations();
|
|
636
|
+
case 7:
|
|
637
|
+
case "end":
|
|
638
|
+
return _context13.stop();
|
|
639
|
+
}
|
|
640
|
+
}, _callee11);
|
|
641
|
+
})));
|
|
642
|
+
test('does not render resize slider input for a non-resizable column', function () {
|
|
643
|
+
render(___EmotionJSX(TableBase, {
|
|
644
|
+
"aria-label": "non-resizable table"
|
|
645
|
+
}, ___EmotionJSX(THead, {
|
|
646
|
+
columns: resizableHeaders
|
|
647
|
+
}, function (head) {
|
|
648
|
+
return ___EmotionJSX(Column, {
|
|
649
|
+
key: head.key
|
|
650
|
+
}, head.name);
|
|
651
|
+
}), ___EmotionJSX(TBody, {
|
|
652
|
+
items: resizableObjects
|
|
653
|
+
}, function (row) {
|
|
654
|
+
return ___EmotionJSX(Row, {
|
|
655
|
+
key: row.key
|
|
656
|
+
}, function (columnKey) {
|
|
657
|
+
return ___EmotionJSX(Cell, null, row[columnKey]);
|
|
658
|
+
});
|
|
659
|
+
})));
|
|
660
|
+
expect(screen.queryByRole('slider')).not.toBeInTheDocument();
|
|
661
|
+
});
|
|
662
|
+
describe('keyboard resizing', function () {
|
|
663
|
+
var getResizableWithCallbacks = function getResizableWithCallbacks() {
|
|
664
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
665
|
+
return render(___EmotionJSX(TableBase, _extends({
|
|
666
|
+
"aria-label": "resizable table"
|
|
667
|
+
}, props), ___EmotionJSX(THead, {
|
|
668
|
+
columns: resizableHeaders
|
|
669
|
+
}, function (head) {
|
|
670
|
+
return ___EmotionJSX(Column, {
|
|
671
|
+
key: head.key,
|
|
672
|
+
allowsResizing: true
|
|
673
|
+
}, head.name);
|
|
674
|
+
}), ___EmotionJSX(TBody, {
|
|
675
|
+
items: resizableObjects
|
|
676
|
+
}, function (row) {
|
|
677
|
+
return ___EmotionJSX(Row, {
|
|
678
|
+
key: row.key
|
|
679
|
+
}, function (columnKey) {
|
|
680
|
+
return ___EmotionJSX(Cell, null, row[columnKey]);
|
|
681
|
+
});
|
|
682
|
+
})));
|
|
683
|
+
};
|
|
684
|
+
test('Enter on resizer input starts resize and calls onResizeStart', function () {
|
|
685
|
+
var onResizeStart = jest.fn();
|
|
686
|
+
getResizableWithCallbacks({
|
|
687
|
+
onResizeStart: onResizeStart
|
|
688
|
+
});
|
|
689
|
+
var slider = screen.getByRole('slider', {
|
|
690
|
+
name: /Name column width/i
|
|
691
|
+
});
|
|
692
|
+
actHooks(function () {
|
|
693
|
+
slider.focus();
|
|
694
|
+
});
|
|
695
|
+
fireEvent.keyDown(slider, {
|
|
696
|
+
key: 'Enter'
|
|
697
|
+
});
|
|
698
|
+
expect(onResizeStart).toHaveBeenCalledTimes(1);
|
|
699
|
+
});
|
|
700
|
+
test('ArrowRight during active resize calls onResize', function () {
|
|
701
|
+
var onResize = jest.fn();
|
|
702
|
+
getResizableWithCallbacks({
|
|
703
|
+
onResize: onResize
|
|
704
|
+
});
|
|
705
|
+
var slider = screen.getByRole('slider', {
|
|
706
|
+
name: /Name column width/i
|
|
707
|
+
});
|
|
708
|
+
actHooks(function () {
|
|
709
|
+
slider.focus();
|
|
710
|
+
});
|
|
711
|
+
fireEvent.keyDown(slider, {
|
|
712
|
+
key: 'Enter'
|
|
713
|
+
});
|
|
714
|
+
fireEvent.keyDown(slider, {
|
|
715
|
+
key: 'ArrowRight'
|
|
716
|
+
});
|
|
717
|
+
expect(onResize).toHaveBeenCalledTimes(1);
|
|
718
|
+
});
|
|
719
|
+
test('ArrowLeft during active resize calls onResize', function () {
|
|
720
|
+
var onResize = jest.fn();
|
|
721
|
+
getResizableWithCallbacks({
|
|
722
|
+
onResize: onResize
|
|
723
|
+
});
|
|
724
|
+
var slider = screen.getByRole('slider', {
|
|
725
|
+
name: /Name column width/i
|
|
726
|
+
});
|
|
727
|
+
actHooks(function () {
|
|
728
|
+
slider.focus();
|
|
729
|
+
});
|
|
730
|
+
fireEvent.keyDown(slider, {
|
|
731
|
+
key: 'Enter'
|
|
732
|
+
});
|
|
733
|
+
fireEvent.keyDown(slider, {
|
|
734
|
+
key: 'ArrowLeft'
|
|
735
|
+
});
|
|
736
|
+
expect(onResize).toHaveBeenCalledTimes(1);
|
|
737
|
+
});
|
|
738
|
+
test('multiple ArrowRight presses each call onResize', function () {
|
|
739
|
+
var onResize = jest.fn();
|
|
740
|
+
getResizableWithCallbacks({
|
|
741
|
+
onResize: onResize
|
|
742
|
+
});
|
|
743
|
+
var slider = screen.getByRole('slider', {
|
|
744
|
+
name: /Name column width/i
|
|
745
|
+
});
|
|
746
|
+
actHooks(function () {
|
|
747
|
+
slider.focus();
|
|
748
|
+
});
|
|
749
|
+
fireEvent.keyDown(slider, {
|
|
750
|
+
key: 'Enter'
|
|
751
|
+
});
|
|
752
|
+
fireEvent.keyDown(slider, {
|
|
753
|
+
key: 'ArrowRight'
|
|
754
|
+
});
|
|
755
|
+
fireEvent.keyDown(slider, {
|
|
756
|
+
key: 'ArrowRight'
|
|
757
|
+
});
|
|
758
|
+
fireEvent.keyDown(slider, {
|
|
759
|
+
key: 'ArrowRight'
|
|
760
|
+
});
|
|
761
|
+
expect(onResize).toHaveBeenCalledTimes(3);
|
|
762
|
+
});
|
|
763
|
+
test('Escape ends resize and calls onResizeEnd', function () {
|
|
764
|
+
var onResizeEnd = jest.fn();
|
|
765
|
+
getResizableWithCallbacks({
|
|
766
|
+
onResizeEnd: onResizeEnd
|
|
767
|
+
});
|
|
768
|
+
var slider = screen.getByRole('slider', {
|
|
769
|
+
name: /Name column width/i
|
|
770
|
+
});
|
|
771
|
+
actHooks(function () {
|
|
772
|
+
slider.focus();
|
|
773
|
+
});
|
|
774
|
+
fireEvent.keyDown(slider, {
|
|
775
|
+
key: 'Enter'
|
|
776
|
+
});
|
|
777
|
+
fireEvent.keyDown(slider, {
|
|
778
|
+
key: 'Escape'
|
|
779
|
+
});
|
|
780
|
+
expect(onResizeEnd).toHaveBeenCalledTimes(1);
|
|
781
|
+
});
|
|
782
|
+
test('Space ends resize and calls onResizeEnd', function () {
|
|
783
|
+
var onResizeEnd = jest.fn();
|
|
784
|
+
getResizableWithCallbacks({
|
|
785
|
+
onResizeEnd: onResizeEnd
|
|
786
|
+
});
|
|
787
|
+
var slider = screen.getByRole('slider', {
|
|
788
|
+
name: /Name column width/i
|
|
789
|
+
});
|
|
790
|
+
actHooks(function () {
|
|
791
|
+
slider.focus();
|
|
792
|
+
});
|
|
793
|
+
fireEvent.keyDown(slider, {
|
|
794
|
+
key: 'Enter'
|
|
795
|
+
});
|
|
796
|
+
fireEvent.keyDown(slider, {
|
|
797
|
+
key: ' '
|
|
798
|
+
});
|
|
799
|
+
expect(onResizeEnd).toHaveBeenCalledTimes(1);
|
|
800
|
+
});
|
|
801
|
+
test('second Enter ends resize and calls onResizeEnd', function () {
|
|
802
|
+
var onResizeEnd = jest.fn();
|
|
803
|
+
getResizableWithCallbacks({
|
|
804
|
+
onResizeEnd: onResizeEnd
|
|
805
|
+
});
|
|
806
|
+
var slider = screen.getByRole('slider', {
|
|
807
|
+
name: /Name column width/i
|
|
808
|
+
});
|
|
809
|
+
actHooks(function () {
|
|
810
|
+
slider.focus();
|
|
811
|
+
});
|
|
812
|
+
fireEvent.keyDown(slider, {
|
|
813
|
+
key: 'Enter'
|
|
814
|
+
});
|
|
815
|
+
fireEvent.keyDown(slider, {
|
|
816
|
+
key: 'Enter'
|
|
817
|
+
});
|
|
818
|
+
expect(onResizeEnd).toHaveBeenCalledTimes(1);
|
|
819
|
+
});
|
|
820
|
+
test('ArrowRight before resize starts does not call onResize', function () {
|
|
821
|
+
var onResize = jest.fn();
|
|
822
|
+
getResizableWithCallbacks({
|
|
823
|
+
onResize: onResize
|
|
824
|
+
});
|
|
825
|
+
var slider = screen.getByRole('slider', {
|
|
826
|
+
name: /Name column width/i
|
|
827
|
+
});
|
|
828
|
+
actHooks(function () {
|
|
829
|
+
slider.focus();
|
|
830
|
+
});
|
|
831
|
+
fireEvent.keyDown(slider, {
|
|
832
|
+
key: 'ArrowRight'
|
|
833
|
+
});
|
|
834
|
+
expect(onResize).not.toHaveBeenCalled();
|
|
835
|
+
});
|
|
836
|
+
test('onResize is not called after resize ends', function () {
|
|
837
|
+
var onResize = jest.fn();
|
|
838
|
+
getResizableWithCallbacks({
|
|
839
|
+
onResize: onResize
|
|
840
|
+
});
|
|
841
|
+
var slider = screen.getByRole('slider', {
|
|
842
|
+
name: /Name column width/i
|
|
843
|
+
});
|
|
844
|
+
actHooks(function () {
|
|
845
|
+
slider.focus();
|
|
846
|
+
});
|
|
847
|
+
fireEvent.keyDown(slider, {
|
|
848
|
+
key: 'Enter'
|
|
849
|
+
});
|
|
850
|
+
fireEvent.keyDown(slider, {
|
|
851
|
+
key: 'Escape'
|
|
852
|
+
});
|
|
853
|
+
fireEvent.keyDown(slider, {
|
|
854
|
+
key: 'ArrowRight'
|
|
855
|
+
});
|
|
856
|
+
expect(onResize).not.toHaveBeenCalled();
|
|
857
|
+
});
|
|
858
|
+
});
|
|
859
|
+
});
|
|
380
860
|
describe('Sortable Table with useAsyncList', function () {
|
|
381
861
|
var dataTestId = 'sortableTable';
|
|
382
862
|
var defaultTableProps = {
|
|
@@ -389,18 +869,18 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
389
869
|
return _load.apply(this, arguments);
|
|
390
870
|
}
|
|
391
871
|
function _load() {
|
|
392
|
-
_load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
393
|
-
return _regeneratorRuntime().wrap(function
|
|
394
|
-
while (1) switch (
|
|
872
|
+
_load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
873
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context24) {
|
|
874
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
395
875
|
case 0:
|
|
396
|
-
return
|
|
876
|
+
return _context24.abrupt("return", {
|
|
397
877
|
items: objects
|
|
398
878
|
});
|
|
399
879
|
case 1:
|
|
400
880
|
case "end":
|
|
401
|
-
return
|
|
881
|
+
return _context24.stop();
|
|
402
882
|
}
|
|
403
|
-
},
|
|
883
|
+
}, _callee20);
|
|
404
884
|
}));
|
|
405
885
|
return _load.apply(this, arguments);
|
|
406
886
|
}
|
|
@@ -408,13 +888,13 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
408
888
|
return _sort.apply(this, arguments);
|
|
409
889
|
}
|
|
410
890
|
function _sort() {
|
|
411
|
-
_sort = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
412
|
-
var
|
|
413
|
-
return _regeneratorRuntime().wrap(function
|
|
414
|
-
while (1) switch (
|
|
891
|
+
_sort = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(list) {
|
|
892
|
+
var _context25;
|
|
893
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context26) {
|
|
894
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
415
895
|
case 0:
|
|
416
896
|
// eslint-disable-next-line no-param-reassign
|
|
417
|
-
list.items = _sortInstanceProperty(
|
|
897
|
+
list.items = _sortInstanceProperty(_context25 = list.items).call(_context25, function (a, b) {
|
|
418
898
|
var first = a[list.sortDescriptor.column];
|
|
419
899
|
var second = b[list.sortDescriptor.column];
|
|
420
900
|
var cmp = (_parseInt(first) || first) < (_parseInt(second) || second) // eslint-disable-line
|
|
@@ -424,17 +904,17 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
424
904
|
}
|
|
425
905
|
return cmp;
|
|
426
906
|
});
|
|
427
|
-
return
|
|
907
|
+
return _context26.abrupt("return", list);
|
|
428
908
|
case 2:
|
|
429
909
|
case "end":
|
|
430
|
-
return
|
|
910
|
+
return _context26.stop();
|
|
431
911
|
}
|
|
432
|
-
},
|
|
912
|
+
}, _callee21);
|
|
433
913
|
}));
|
|
434
914
|
return _sort.apply(this, arguments);
|
|
435
915
|
}
|
|
436
|
-
var sortableDataTable = function sortableDataTable(
|
|
437
|
-
var result =
|
|
916
|
+
var sortableDataTable = function sortableDataTable(_ref12) {
|
|
917
|
+
var result = _ref12.result;
|
|
438
918
|
return render(___EmotionJSX(TableBase, _extends({}, defaultTableProps, {
|
|
439
919
|
sortDescriptor: result.current.sortDescriptor
|
|
440
920
|
}), ___EmotionJSX(THead, {
|
|
@@ -451,10 +931,10 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
451
931
|
});
|
|
452
932
|
})));
|
|
453
933
|
};
|
|
454
|
-
test('sort by country column A => Z', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
934
|
+
test('sort by country column A => Z', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
455
935
|
var _renderHook, result, sortableTable, rowgroups, thead, headerCells, tRows;
|
|
456
|
-
return _regeneratorRuntime().wrap(function
|
|
457
|
-
while (1) switch (
|
|
936
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context18) {
|
|
937
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
458
938
|
case 0:
|
|
459
939
|
_renderHook = renderHook(function () {
|
|
460
940
|
return useAsyncList({
|
|
@@ -466,47 +946,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
466
946
|
}
|
|
467
947
|
});
|
|
468
948
|
}), result = _renderHook.result;
|
|
469
|
-
|
|
470
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
471
|
-
return _regeneratorRuntime().wrap(function
|
|
472
|
-
while (1) switch (
|
|
949
|
+
_context18.next = 3;
|
|
950
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
951
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context14) {
|
|
952
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
473
953
|
case 0:
|
|
474
954
|
jest.runOnlyPendingTimers();
|
|
475
955
|
case 1:
|
|
476
956
|
case "end":
|
|
477
|
-
return
|
|
957
|
+
return _context14.stop();
|
|
478
958
|
}
|
|
479
|
-
},
|
|
959
|
+
}, _callee12);
|
|
480
960
|
})));
|
|
481
961
|
case 3:
|
|
482
|
-
|
|
483
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
484
|
-
var
|
|
485
|
-
return _regeneratorRuntime().wrap(function
|
|
486
|
-
while (1) switch (
|
|
962
|
+
_context18.next = 5;
|
|
963
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
964
|
+
var _context15;
|
|
965
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context16) {
|
|
966
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
487
967
|
case 0:
|
|
488
|
-
_sortInstanceProperty(
|
|
968
|
+
_sortInstanceProperty(_context15 = result.current).call(_context15, {
|
|
489
969
|
column: 'country',
|
|
490
970
|
direction: 'ascending'
|
|
491
971
|
});
|
|
492
972
|
case 1:
|
|
493
973
|
case "end":
|
|
494
|
-
return
|
|
974
|
+
return _context16.stop();
|
|
495
975
|
}
|
|
496
|
-
},
|
|
976
|
+
}, _callee13);
|
|
497
977
|
})));
|
|
498
978
|
case 5:
|
|
499
|
-
|
|
500
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
501
|
-
return _regeneratorRuntime().wrap(function
|
|
502
|
-
while (1) switch (
|
|
979
|
+
_context18.next = 7;
|
|
980
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
981
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context17) {
|
|
982
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
503
983
|
case 0:
|
|
504
984
|
jest.runOnlyPendingTimers();
|
|
505
985
|
case 1:
|
|
506
986
|
case "end":
|
|
507
|
-
return
|
|
987
|
+
return _context17.stop();
|
|
508
988
|
}
|
|
509
|
-
},
|
|
989
|
+
}, _callee14);
|
|
510
990
|
})));
|
|
511
991
|
case 7:
|
|
512
992
|
sortableDataTable({
|
|
@@ -534,14 +1014,14 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
534
1014
|
expect(tRows[3]).toHaveTextContent('USA');
|
|
535
1015
|
case 28:
|
|
536
1016
|
case "end":
|
|
537
|
-
return
|
|
1017
|
+
return _context18.stop();
|
|
538
1018
|
}
|
|
539
|
-
},
|
|
1019
|
+
}, _callee15);
|
|
540
1020
|
})));
|
|
541
|
-
test('sort by country column Z => A', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1021
|
+
test('sort by country column Z => A', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
542
1022
|
var _renderHook2, result, sortableTable, rowgroups, tRows;
|
|
543
|
-
return _regeneratorRuntime().wrap(function
|
|
544
|
-
while (1) switch (
|
|
1023
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context23) {
|
|
1024
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
545
1025
|
case 0:
|
|
546
1026
|
_renderHook2 = renderHook(function () {
|
|
547
1027
|
return useAsyncList({
|
|
@@ -553,47 +1033,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
553
1033
|
}
|
|
554
1034
|
});
|
|
555
1035
|
}), result = _renderHook2.result;
|
|
556
|
-
|
|
557
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
558
|
-
return _regeneratorRuntime().wrap(function
|
|
559
|
-
while (1) switch (
|
|
1036
|
+
_context23.next = 3;
|
|
1037
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1038
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context19) {
|
|
1039
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
560
1040
|
case 0:
|
|
561
1041
|
jest.runOnlyPendingTimers();
|
|
562
1042
|
case 1:
|
|
563
1043
|
case "end":
|
|
564
|
-
return
|
|
1044
|
+
return _context19.stop();
|
|
565
1045
|
}
|
|
566
|
-
},
|
|
1046
|
+
}, _callee16);
|
|
567
1047
|
})));
|
|
568
1048
|
case 3:
|
|
569
|
-
|
|
570
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
571
|
-
var
|
|
572
|
-
return _regeneratorRuntime().wrap(function
|
|
573
|
-
while (1) switch (
|
|
1049
|
+
_context23.next = 5;
|
|
1050
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1051
|
+
var _context20;
|
|
1052
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context21) {
|
|
1053
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
574
1054
|
case 0:
|
|
575
|
-
_sortInstanceProperty(
|
|
1055
|
+
_sortInstanceProperty(_context20 = result.current).call(_context20, {
|
|
576
1056
|
column: 'country',
|
|
577
1057
|
direction: 'descending'
|
|
578
1058
|
});
|
|
579
1059
|
case 1:
|
|
580
1060
|
case "end":
|
|
581
|
-
return
|
|
1061
|
+
return _context21.stop();
|
|
582
1062
|
}
|
|
583
|
-
},
|
|
1063
|
+
}, _callee17);
|
|
584
1064
|
})));
|
|
585
1065
|
case 5:
|
|
586
|
-
|
|
587
|
-
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
588
|
-
return _regeneratorRuntime().wrap(function
|
|
589
|
-
while (1) switch (
|
|
1066
|
+
_context23.next = 7;
|
|
1067
|
+
return actHooks(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1068
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context22) {
|
|
1069
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
590
1070
|
case 0:
|
|
591
1071
|
jest.runOnlyPendingTimers();
|
|
592
1072
|
case 1:
|
|
593
1073
|
case "end":
|
|
594
|
-
return
|
|
1074
|
+
return _context22.stop();
|
|
595
1075
|
}
|
|
596
|
-
},
|
|
1076
|
+
}, _callee18);
|
|
597
1077
|
})));
|
|
598
1078
|
case 7:
|
|
599
1079
|
sortableDataTable({
|
|
@@ -617,8 +1097,8 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
617
1097
|
expect(tRows[3]).toHaveTextContent('Canada');
|
|
618
1098
|
case 24:
|
|
619
1099
|
case "end":
|
|
620
|
-
return
|
|
1100
|
+
return _context23.stop();
|
|
621
1101
|
}
|
|
622
|
-
},
|
|
1102
|
+
}, _callee19);
|
|
623
1103
|
})));
|
|
624
1104
|
});
|