@pingux/astro 2.218.0 → 2.219.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/NumberField/NumberField.d.ts +4 -0
- package/lib/cjs/components/NumberField/NumberField.js +21 -93
- package/lib/cjs/components/NumberField/NumberField.styles.d.ts +19 -0
- package/lib/cjs/components/NumberField/index.d.ts +1 -0
- package/lib/cjs/components/TableBase/TableBase.js +12 -6
- package/lib/cjs/components/TableBase/TableBase.mdx +14 -20
- package/lib/cjs/components/TableBase/TableBase.stories.js +148 -2
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +33 -0
- package/lib/cjs/components/TableBase/TableBase.styles.js +31 -5
- package/lib/cjs/components/TableBase/TableBase.test.js +243 -433
- package/lib/cjs/hooks/useField/useField.d.ts +2 -0
- package/lib/cjs/hooks/useSliderField/useSliderField.d.ts +3 -0
- package/lib/cjs/types/box.d.ts +1 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +35 -24
- package/lib/cjs/types/numberField.d.ts +30 -0
- package/lib/cjs/types/numberField.js +6 -0
- package/lib/components/NumberField/NumberField.js +23 -95
- package/lib/components/TableBase/TableBase.js +12 -6
- package/lib/components/TableBase/TableBase.mdx +14 -20
- package/lib/components/TableBase/TableBase.stories.js +147 -1
- package/lib/components/TableBase/TableBase.styles.js +31 -5
- package/lib/components/TableBase/TableBase.test.js +243 -433
- package/lib/types/index.js +1 -0
- package/lib/types/numberField.js +1 -0
- package/package.json +1 -1
|
@@ -14,7 +14,6 @@ var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/in
|
|
|
14
14
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
15
15
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
16
16
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
17
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
18
17
|
var _sort2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
19
18
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
|
20
19
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
@@ -442,7 +441,7 @@ test('Arrow Down key should focus the next row', /*#__PURE__*/(0, _asyncToGenera
|
|
|
442
441
|
}, _callee9);
|
|
443
442
|
})));
|
|
444
443
|
test('Arrow Up key should focus the next row', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0() {
|
|
445
|
-
var rows, columnheader;
|
|
444
|
+
var rows, columnheader, headerButton;
|
|
446
445
|
return _regeneratorRuntime().wrap(function _callee0$(_context10) {
|
|
447
446
|
while (1) switch (_context10.prev = _context10.next) {
|
|
448
447
|
case 0:
|
|
@@ -458,9 +457,14 @@ test('Arrow Up key should focus the next row', /*#__PURE__*/(0, _asyncToGenerato
|
|
|
458
457
|
_react2.fireEvent.keyUp(rows[1], {
|
|
459
458
|
key: 'ArrowUp'
|
|
460
459
|
});
|
|
460
|
+
|
|
461
|
+
// Column header content is rendered inside a focusable button, so focus
|
|
462
|
+
// moves into that child (focusMode: 'child') rather than the <th> itself.
|
|
461
463
|
columnheader = _react2.screen.getAllByRole('columnheader');
|
|
462
|
-
|
|
463
|
-
|
|
464
|
+
headerButton = (0, _react2.within)(columnheader[0]).getByRole('button');
|
|
465
|
+
expect(headerButton).toHaveFocus();
|
|
466
|
+
expect(columnheader[0]).toHaveClass('is-focused');
|
|
467
|
+
case 11:
|
|
464
468
|
case "end":
|
|
465
469
|
return _context10.stop();
|
|
466
470
|
}
|
|
@@ -956,400 +960,206 @@ describe('Resizable columns', function () {
|
|
|
956
960
|
});
|
|
957
961
|
});
|
|
958
962
|
});
|
|
959
|
-
describe('
|
|
960
|
-
|
|
961
|
-
|
|
963
|
+
describe('Sorting and resizing together', function () {
|
|
964
|
+
var combinedHeaders = [{
|
|
965
|
+
key: 'name',
|
|
966
|
+
name: 'Name'
|
|
967
|
+
}, {
|
|
968
|
+
key: 'value',
|
|
969
|
+
name: 'Value'
|
|
970
|
+
}];
|
|
971
|
+
var combinedObjects = [{
|
|
972
|
+
key: '1',
|
|
973
|
+
name: 'Alpha',
|
|
974
|
+
value: '10'
|
|
975
|
+
}, {
|
|
976
|
+
key: '2',
|
|
977
|
+
name: 'Beta',
|
|
978
|
+
value: '20'
|
|
979
|
+
}];
|
|
980
|
+
var getCombinedTable = function getCombinedTable() {
|
|
981
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
982
|
+
return (0, _react2.render)((0, _react3.jsx)(_TableBase["default"], (0, _extends2["default"])({
|
|
983
|
+
"aria-label": "sortable and resizable table"
|
|
984
|
+
}, props), (0, _react3.jsx)(_index.THead, {
|
|
985
|
+
columns: combinedHeaders
|
|
986
|
+
}, function (head) {
|
|
987
|
+
return (0, _react3.jsx)(_index.Column, {
|
|
988
|
+
key: head.key,
|
|
989
|
+
allowsSorting: true,
|
|
990
|
+
allowsResizing: true
|
|
991
|
+
}, head.name);
|
|
992
|
+
}), (0, _react3.jsx)(_index.TBody, {
|
|
993
|
+
items: combinedObjects
|
|
994
|
+
}, function (row) {
|
|
995
|
+
return (0, _react3.jsx)(_index.Row, {
|
|
996
|
+
key: row.key
|
|
997
|
+
}, function (columnKey) {
|
|
998
|
+
return (0, _react3.jsx)(_index.Cell, null, row[columnKey]);
|
|
999
|
+
});
|
|
1000
|
+
})));
|
|
1001
|
+
};
|
|
1002
|
+
test('renders both the sort button and resize slider for a column that allows both', function () {
|
|
1003
|
+
getCombinedTable();
|
|
1004
|
+
var columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1005
|
+
var sortButton = (0, _react2.within)(columnheaders[0]).getByRole('button', {
|
|
1006
|
+
name: /Sort by Name/i
|
|
1007
|
+
});
|
|
1008
|
+
expect(sortButton).toBeInTheDocument();
|
|
1009
|
+
var slider = (0, _react2.within)(columnheaders[0]).getByRole('slider', {
|
|
1010
|
+
name: /Name column width/i
|
|
1011
|
+
});
|
|
1012
|
+
expect(slider).toBeInTheDocument();
|
|
1013
|
+
});
|
|
1014
|
+
test('resizable table with sorting has no accessibility violations', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1015
|
+
var _getCombinedTable, container, results;
|
|
962
1016
|
return _regeneratorRuntime().wrap(function _callee12$(_context14) {
|
|
963
1017
|
while (1) switch (_context14.prev = _context14.next) {
|
|
964
1018
|
case 0:
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1019
|
+
jest.useRealTimers();
|
|
1020
|
+
_getCombinedTable = getCombinedTable({
|
|
1021
|
+
sortDescriptor: {
|
|
1022
|
+
column: 'name',
|
|
1023
|
+
direction: 'ascending'
|
|
1024
|
+
}
|
|
1025
|
+
}), container = _getCombinedTable.container;
|
|
1026
|
+
_context14.next = 4;
|
|
1027
|
+
return (0, _jestAxe.axe)(container);
|
|
1028
|
+
case 4:
|
|
1029
|
+
results = _context14.sent;
|
|
1030
|
+
jest.useFakeTimers();
|
|
1031
|
+
expect(results).toHaveNoViolations();
|
|
1032
|
+
case 7:
|
|
977
1033
|
case "end":
|
|
978
1034
|
return _context14.stop();
|
|
979
1035
|
}
|
|
980
1036
|
}, _callee12);
|
|
981
1037
|
})));
|
|
982
|
-
test('
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1038
|
+
test('clicking the sort button calls onSortChange without triggering a resize', function () {
|
|
1039
|
+
// TableBase forwards unrecognized props (including onSortChange) onto the
|
|
1040
|
+
// underlying <table> DOM node, which logs a React "unknown prop" warning.
|
|
1041
|
+
// Suppressed here since it's orthogonal to the sort/resize behavior under test.
|
|
1042
|
+
jest.spyOn(console, 'error').mockImplementation();
|
|
1043
|
+
var onSortChange = jest.fn();
|
|
1044
|
+
var onResize = jest.fn();
|
|
1045
|
+
getCombinedTable({
|
|
1046
|
+
onSortChange: onSortChange,
|
|
1047
|
+
onResize: onResize
|
|
987
1048
|
});
|
|
988
|
-
var
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
(0, _forEach["default"])(_context15 = (0, _slice["default"])(rows).call(rows, 1)).call(_context15, function (row) {
|
|
992
|
-
expect(row).toHaveClass('has-actions');
|
|
1049
|
+
var columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1050
|
+
var sortButton = (0, _react2.within)(columnheaders[0]).getByRole('button', {
|
|
1051
|
+
name: /Sort by Name/i
|
|
993
1052
|
});
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
var rows = _react2.screen.getAllByRole('row');
|
|
999
|
-
(0, _forEach["default"])(_context16 = (0, _slice["default"])(rows).call(rows, 1)).call(_context16, function (row) {
|
|
1000
|
-
expect(row).not.toHaveClass('has-actions');
|
|
1053
|
+
_react2.fireEvent.click(sortButton);
|
|
1054
|
+
expect(onSortChange).toHaveBeenCalledWith({
|
|
1055
|
+
column: 'name',
|
|
1056
|
+
direction: 'ascending'
|
|
1001
1057
|
});
|
|
1058
|
+
expect(onResize).not.toHaveBeenCalled();
|
|
1002
1059
|
});
|
|
1003
|
-
test('
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
onRowAction = jest.fn();
|
|
1009
|
-
getComponent({
|
|
1010
|
-
selectionMode: 'none',
|
|
1011
|
-
onRowAction: onRowAction
|
|
1012
|
-
});
|
|
1013
|
-
rows = _react2.screen.getAllByRole('row');
|
|
1014
|
-
_context17.next = 5;
|
|
1015
|
-
return _userEvent["default"].tab();
|
|
1016
|
-
case 5:
|
|
1017
|
-
expect(rows[1]).toHaveFocus();
|
|
1018
|
-
|
|
1019
|
-
// React Aria's usePress fires the action on keyUp (press completion),
|
|
1020
|
-
// so both keyDown and keyUp must be fired.
|
|
1021
|
-
_react2.fireEvent.keyDown(rows[1], {
|
|
1022
|
-
key: 'Enter'
|
|
1023
|
-
});
|
|
1024
|
-
_react2.fireEvent.keyUp(rows[1], {
|
|
1025
|
-
key: 'Enter'
|
|
1026
|
-
});
|
|
1027
|
-
expect(onRowAction).toHaveBeenCalledTimes(1);
|
|
1028
|
-
expect(onRowAction).toHaveBeenCalledWith('1');
|
|
1029
|
-
case 10:
|
|
1030
|
-
case "end":
|
|
1031
|
-
return _context17.stop();
|
|
1032
|
-
}
|
|
1033
|
-
}, _callee13);
|
|
1034
|
-
})));
|
|
1035
|
-
test('clicking an action row applies is-focused class to that row', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1036
|
-
var onRowAction, rows, firstBodyRowCells, secondBodyRowCells;
|
|
1037
|
-
return _regeneratorRuntime().wrap(function _callee14$(_context18) {
|
|
1038
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
1039
|
-
case 0:
|
|
1040
|
-
onRowAction = jest.fn();
|
|
1041
|
-
getComponent({
|
|
1042
|
-
onRowAction: onRowAction
|
|
1043
|
-
});
|
|
1044
|
-
rows = _react2.screen.getAllByRole('row'); // Click a cell in the first body row (rows[0] is the header row)
|
|
1045
|
-
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1046
|
-
_context18.next = 6;
|
|
1047
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1048
|
-
case 6:
|
|
1049
|
-
// First body row should have is-focused; all other body rows should not
|
|
1050
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1051
|
-
expect(rows[2]).not.toHaveClass('is-focused');
|
|
1052
|
-
expect(rows[3]).not.toHaveClass('is-focused');
|
|
1053
|
-
expect(rows[4]).not.toHaveClass('is-focused');
|
|
1054
|
-
|
|
1055
|
-
// Click a cell in the second body row — highlight should move
|
|
1056
|
-
secondBodyRowCells = rows[2].querySelectorAll('td');
|
|
1057
|
-
_context18.next = 13;
|
|
1058
|
-
return _userEvent["default"].click(secondBodyRowCells[0]);
|
|
1059
|
-
case 13:
|
|
1060
|
-
expect(rows[2]).toHaveClass('is-focused');
|
|
1061
|
-
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1062
|
-
case 15:
|
|
1063
|
-
case "end":
|
|
1064
|
-
return _context18.stop();
|
|
1060
|
+
test('sets aria-sort on a column header that also allows resizing', function () {
|
|
1061
|
+
getCombinedTable({
|
|
1062
|
+
sortDescriptor: {
|
|
1063
|
+
column: 'name',
|
|
1064
|
+
direction: 'ascending'
|
|
1065
1065
|
}
|
|
1066
|
-
}, _callee14);
|
|
1067
|
-
})));
|
|
1068
|
-
test('no row has is-focused before any click with onRowAction', function () {
|
|
1069
|
-
var _context19;
|
|
1070
|
-
var onRowAction = jest.fn();
|
|
1071
|
-
getComponent({
|
|
1072
|
-
onRowAction: onRowAction
|
|
1073
1066
|
});
|
|
1074
|
-
var
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1067
|
+
var columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1068
|
+
expect(columnheaders[0]).toHaveAttribute('aria-sort', 'ascending');
|
|
1069
|
+
expect(columnheaders[1]).toHaveAttribute('aria-sort', 'none');
|
|
1070
|
+
});
|
|
1071
|
+
test('resizing via the slider does not call onSortChange', function () {
|
|
1072
|
+
jest.spyOn(console, 'error').mockImplementation();
|
|
1073
|
+
var onSortChange = jest.fn();
|
|
1074
|
+
var onResize = jest.fn();
|
|
1075
|
+
getCombinedTable({
|
|
1076
|
+
onSortChange: onSortChange,
|
|
1077
|
+
onResize: onResize
|
|
1078
|
+
});
|
|
1079
|
+
var columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1080
|
+
var slider = (0, _react2.within)(columnheaders[0]).getByRole('slider', {
|
|
1081
|
+
name: /Name column width/i
|
|
1079
1082
|
});
|
|
1083
|
+
(0, _react2.act)(function () {
|
|
1084
|
+
slider.focus();
|
|
1085
|
+
});
|
|
1086
|
+
_react2.fireEvent.keyDown(slider, {
|
|
1087
|
+
key: 'Enter'
|
|
1088
|
+
});
|
|
1089
|
+
_react2.fireEvent.keyDown(slider, {
|
|
1090
|
+
key: 'ArrowRight'
|
|
1091
|
+
});
|
|
1092
|
+
expect(onResize).toHaveBeenCalledTimes(1);
|
|
1093
|
+
expect(onSortChange).not.toHaveBeenCalled();
|
|
1080
1094
|
});
|
|
1081
|
-
test('
|
|
1082
|
-
var
|
|
1083
|
-
return _regeneratorRuntime().wrap(function
|
|
1084
|
-
while (1) switch (
|
|
1085
|
-
case 0:
|
|
1086
|
-
getComponent();
|
|
1087
|
-
rows = _react2.screen.getAllByRole('row');
|
|
1088
|
-
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1089
|
-
_context20.next = 5;
|
|
1090
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1091
|
-
case 5:
|
|
1092
|
-
// Without onRowAction the active-row path is not triggered
|
|
1093
|
-
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1094
|
-
case 6:
|
|
1095
|
-
case "end":
|
|
1096
|
-
return _context20.stop();
|
|
1097
|
-
}
|
|
1098
|
-
}, _callee15);
|
|
1099
|
-
})));
|
|
1100
|
-
test('keyboard-focused row receives is-focused when onRowAction is present (AC4)', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1101
|
-
var onRowAction, rows;
|
|
1102
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context21) {
|
|
1103
|
-
while (1) switch (_context21.prev = _context21.next) {
|
|
1095
|
+
test('sort button and resize slider are independently focusable within the same column header', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1096
|
+
var columnheaders, sortButton, slider, rows;
|
|
1097
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context15) {
|
|
1098
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1104
1099
|
case 0:
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1100
|
+
getCombinedTable();
|
|
1101
|
+
columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1102
|
+
sortButton = (0, _react2.within)(columnheaders[0]).getByRole('button', {
|
|
1103
|
+
name: /Sort by Name/i
|
|
1109
1104
|
});
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
return _userEvent["default"].tab();
|
|
1113
|
-
case 5:
|
|
1114
|
-
expect(rows[1]).toHaveFocus();
|
|
1115
|
-
|
|
1116
|
-
// The row must have is-focused from keyboard focus (isFocusVisible path unchanged)
|
|
1117
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1118
|
-
case 7:
|
|
1119
|
-
case "end":
|
|
1120
|
-
return _context21.stop();
|
|
1121
|
-
}
|
|
1122
|
-
}, _callee16);
|
|
1123
|
-
})));
|
|
1124
|
-
test('is-focused class appears only once when keyboard-focused row is also the active row (AC5)', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1125
|
-
var _context22;
|
|
1126
|
-
var onRowAction, rows, firstBodyRowCells, isFocusedCount;
|
|
1127
|
-
return _regeneratorRuntime().wrap(function _callee17$(_context23) {
|
|
1128
|
-
while (1) switch (_context23.prev = _context23.next) {
|
|
1129
|
-
case 0:
|
|
1130
|
-
onRowAction = jest.fn();
|
|
1131
|
-
getComponent({
|
|
1132
|
-
selectionMode: 'none',
|
|
1133
|
-
onRowAction: onRowAction
|
|
1134
|
-
});
|
|
1135
|
-
rows = _react2.screen.getAllByRole('row'); // Click the first body row to set activeRowKey
|
|
1136
|
-
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1137
|
-
_context23.next = 6;
|
|
1138
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1139
|
-
case 6:
|
|
1140
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1141
|
-
|
|
1142
|
-
// Count occurrences of the class — must be exactly 1
|
|
1143
|
-
isFocusedCount = (0, _filter["default"])(_context22 = rows[1].className.split(/\s+/)).call(_context22, function (cls) {
|
|
1144
|
-
return cls === 'is-focused';
|
|
1145
|
-
}).length;
|
|
1146
|
-
expect(isFocusedCount).toBe(1);
|
|
1147
|
-
case 9:
|
|
1148
|
-
case "end":
|
|
1149
|
-
return _context23.stop();
|
|
1150
|
-
}
|
|
1151
|
-
}, _callee17);
|
|
1152
|
-
})));
|
|
1153
|
-
test('clicking a row focuses the row <tr> so arrow keys work via React Aria', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1154
|
-
var onRowAction, rows, firstBodyRowCells;
|
|
1155
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context24) {
|
|
1156
|
-
while (1) switch (_context24.prev = _context24.next) {
|
|
1157
|
-
case 0:
|
|
1158
|
-
onRowAction = jest.fn();
|
|
1159
|
-
getComponent({
|
|
1160
|
-
onRowAction: onRowAction
|
|
1161
|
-
});
|
|
1162
|
-
rows = _react2.screen.getAllByRole('row'); // Click a cell in the first body row
|
|
1163
|
-
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1164
|
-
_context24.next = 6;
|
|
1165
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1166
|
-
case 6:
|
|
1167
|
-
// The <tr> for the clicked row should now have DOM focus
|
|
1168
|
-
expect(rows[1]).toHaveFocus();
|
|
1169
|
-
|
|
1170
|
-
// Arrow keys should then navigate via React Aria
|
|
1171
|
-
_react2.fireEvent.keyDown(rows[1], {
|
|
1172
|
-
key: 'ArrowDown'
|
|
1173
|
-
});
|
|
1174
|
-
_react2.fireEvent.keyUp(rows[1], {
|
|
1175
|
-
key: 'ArrowDown'
|
|
1176
|
-
});
|
|
1177
|
-
expect(rows[2]).toHaveFocus();
|
|
1178
|
-
case 10:
|
|
1179
|
-
case "end":
|
|
1180
|
-
return _context24.stop();
|
|
1181
|
-
}
|
|
1182
|
-
}, _callee18);
|
|
1183
|
-
})));
|
|
1184
|
-
test('is-focused (active border) clears when focus leaves the table', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1185
|
-
var onRowAction, rows, firstBodyRowCells;
|
|
1186
|
-
return _regeneratorRuntime().wrap(function _callee19$(_context25) {
|
|
1187
|
-
while (1) switch (_context25.prev = _context25.next) {
|
|
1188
|
-
case 0:
|
|
1189
|
-
onRowAction = jest.fn();
|
|
1190
|
-
getComponent({
|
|
1191
|
-
onRowAction: onRowAction
|
|
1192
|
-
});
|
|
1193
|
-
rows = _react2.screen.getAllByRole('row'); // Click a cell in the first body row to set activeRowKey
|
|
1194
|
-
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1195
|
-
_context25.next = 6;
|
|
1196
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1197
|
-
case 6:
|
|
1198
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1199
|
-
|
|
1200
|
-
// Flush the setTimeout(0) that resets actionJustFired so the blur handler
|
|
1201
|
-
// can proceed normally for genuine focus-out events.
|
|
1202
|
-
(0, _react2.act)(function () {
|
|
1203
|
-
jest.runAllTimers();
|
|
1204
|
-
});
|
|
1205
|
-
|
|
1206
|
-
// Use focusOut (which bubbles) to reach the onBlur handler on the scroll
|
|
1207
|
-
// container, simulating focus leaving the table entirely.
|
|
1208
|
-
_react2.fireEvent.focusOut(rows[1], {
|
|
1209
|
-
relatedTarget: null
|
|
1210
|
-
});
|
|
1211
|
-
|
|
1212
|
-
// is-focused should be cleared
|
|
1213
|
-
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1214
|
-
case 10:
|
|
1215
|
-
case "end":
|
|
1216
|
-
return _context25.stop();
|
|
1217
|
-
}
|
|
1218
|
-
}, _callee19);
|
|
1219
|
-
})));
|
|
1220
|
-
test('clicking an already-active row toggles activeRowKey off (clears is-focused)', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1221
|
-
var onRowAction, rows, firstBodyRowCells;
|
|
1222
|
-
return _regeneratorRuntime().wrap(function _callee20$(_context26) {
|
|
1223
|
-
while (1) switch (_context26.prev = _context26.next) {
|
|
1224
|
-
case 0:
|
|
1225
|
-
onRowAction = jest.fn();
|
|
1226
|
-
getComponent({
|
|
1227
|
-
onRowAction: onRowAction
|
|
1228
|
-
});
|
|
1229
|
-
rows = _react2.screen.getAllByRole('row');
|
|
1230
|
-
firstBodyRowCells = rows[1].querySelectorAll('td'); // First click sets the row as active
|
|
1231
|
-
_context26.next = 6;
|
|
1232
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1233
|
-
case 6:
|
|
1234
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1235
|
-
|
|
1236
|
-
// Second click on the same row should toggle it off
|
|
1237
|
-
_context26.next = 9;
|
|
1238
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1239
|
-
case 9:
|
|
1240
|
-
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1241
|
-
case 10:
|
|
1242
|
-
case "end":
|
|
1243
|
-
return _context26.stop();
|
|
1244
|
-
}
|
|
1245
|
-
}, _callee20);
|
|
1246
|
-
})));
|
|
1247
|
-
test('active-row highlight does not clear when focus moves to an overlay panel', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1248
|
-
var onRowAction, rows, firstBodyRowCells, panelButton;
|
|
1249
|
-
return _regeneratorRuntime().wrap(function _callee21$(_context27) {
|
|
1250
|
-
while (1) switch (_context27.prev = _context27.next) {
|
|
1251
|
-
case 0:
|
|
1252
|
-
onRowAction = jest.fn();
|
|
1253
|
-
getComponent({
|
|
1254
|
-
onRowAction: onRowAction
|
|
1105
|
+
slider = (0, _react2.within)(columnheaders[0]).getByRole('slider', {
|
|
1106
|
+
name: /Name column width/i
|
|
1255
1107
|
});
|
|
1256
|
-
rows = _react2.screen.getAllByRole('row'); //
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1260
|
-
case 6:
|
|
1261
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1262
|
-
|
|
1263
|
-
// Simulate OverlayPanel FocusScope stealing focus to an element outside the table.
|
|
1264
|
-
// The actionJustFired guard (set synchronously in wrappedOnRowAction) should
|
|
1265
|
-
// absorb this blur and keep the active-row highlight intact.
|
|
1266
|
-
panelButton = document.createElement('button');
|
|
1267
|
-
document.body.appendChild(panelButton);
|
|
1268
|
-
_react2.fireEvent.focusOut(rows[1], {
|
|
1269
|
-
relatedTarget: panelButton
|
|
1270
|
-
});
|
|
1271
|
-
|
|
1272
|
-
// Highlight must survive the focus-steal
|
|
1273
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1274
|
-
document.body.removeChild(panelButton);
|
|
1275
|
-
case 12:
|
|
1276
|
-
case "end":
|
|
1277
|
-
return _context27.stop();
|
|
1278
|
-
}
|
|
1279
|
-
}, _callee21);
|
|
1280
|
-
})));
|
|
1281
|
-
test('Enter key on a focused action row applies is-focused to that row', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1282
|
-
var onRowAction, rows;
|
|
1283
|
-
return _regeneratorRuntime().wrap(function _callee22$(_context28) {
|
|
1284
|
-
while (1) switch (_context28.prev = _context28.next) {
|
|
1285
|
-
case 0:
|
|
1286
|
-
onRowAction = jest.fn();
|
|
1287
|
-
getComponent({
|
|
1288
|
-
selectionMode: 'none',
|
|
1289
|
-
onRowAction: onRowAction
|
|
1290
|
-
});
|
|
1291
|
-
rows = _react2.screen.getAllByRole('row'); // Tab to put keyboard focus on the first body row
|
|
1292
|
-
_context28.next = 5;
|
|
1108
|
+
rows = _react2.screen.getAllByRole('row'); // Tab into the first body row, then ArrowUp moves focus into the
|
|
1109
|
+
// column header's focusable child (the sort button, per focusMode: 'child').
|
|
1110
|
+
_context15.next = 7;
|
|
1293
1111
|
return _userEvent["default"].tab();
|
|
1294
|
-
case
|
|
1112
|
+
case 7:
|
|
1295
1113
|
expect(rows[1]).toHaveFocus();
|
|
1296
|
-
|
|
1297
|
-
// Press Enter to trigger onRowAction via keyboard
|
|
1298
1114
|
_react2.fireEvent.keyDown(rows[1], {
|
|
1299
|
-
key: '
|
|
1115
|
+
key: 'ArrowUp'
|
|
1300
1116
|
});
|
|
1301
1117
|
_react2.fireEvent.keyUp(rows[1], {
|
|
1302
|
-
key: '
|
|
1303
|
-
});
|
|
1304
|
-
expect(onRowAction).toHaveBeenCalledWith('1');
|
|
1305
|
-
|
|
1306
|
-
// The row should carry is-focused (active-row state set from keyboard action)
|
|
1307
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1308
|
-
case 10:
|
|
1309
|
-
case "end":
|
|
1310
|
-
return _context28.stop();
|
|
1311
|
-
}
|
|
1312
|
-
}, _callee22);
|
|
1313
|
-
})));
|
|
1314
|
-
test('active-row highlight clears when arrow keys move focus to another row', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1315
|
-
var onRowAction, rows, firstBodyRowCells;
|
|
1316
|
-
return _regeneratorRuntime().wrap(function _callee23$(_context29) {
|
|
1317
|
-
while (1) switch (_context29.prev = _context29.next) {
|
|
1318
|
-
case 0:
|
|
1319
|
-
onRowAction = jest.fn();
|
|
1320
|
-
getComponent({
|
|
1321
|
-
onRowAction: onRowAction
|
|
1118
|
+
key: 'ArrowUp'
|
|
1322
1119
|
});
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
1327
|
-
case 6:
|
|
1328
|
-
// Flush the setTimeout(0) guard so subsequent focus events are not swallowed
|
|
1329
|
-
(0, _react2.act)(function () {
|
|
1330
|
-
jest.runAllTimers();
|
|
1331
|
-
});
|
|
1332
|
-
expect(rows[1]).toHaveClass('is-focused');
|
|
1333
|
-
|
|
1334
|
-
// Simulate the panel closing by returning focus to the row
|
|
1335
|
-
_react2.fireEvent.focus(rows[1]);
|
|
1336
|
-
|
|
1337
|
-
// Arrow Down moves focus to row 2 — row 1 should lose is-focused
|
|
1338
|
-
_react2.fireEvent.keyDown(rows[1], {
|
|
1339
|
-
key: 'ArrowDown'
|
|
1120
|
+
expect(sortButton).toHaveFocus();
|
|
1121
|
+
_react2.fireEvent.keyDown(columnheaders[0], {
|
|
1122
|
+
key: 'ArrowRight'
|
|
1340
1123
|
});
|
|
1341
|
-
_react2.fireEvent.keyUp(
|
|
1342
|
-
key: '
|
|
1124
|
+
_react2.fireEvent.keyUp(columnheaders[0], {
|
|
1125
|
+
key: 'ArrowRight'
|
|
1343
1126
|
});
|
|
1344
|
-
|
|
1345
|
-
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1346
|
-
expect(rows[2]).toHaveFocus();
|
|
1127
|
+
expect(slider).toHaveFocus();
|
|
1347
1128
|
case 14:
|
|
1348
1129
|
case "end":
|
|
1349
|
-
return
|
|
1130
|
+
return _context15.stop();
|
|
1350
1131
|
}
|
|
1351
|
-
},
|
|
1132
|
+
}, _callee13);
|
|
1352
1133
|
})));
|
|
1134
|
+
test('resizing a column does not change its sort state', function () {
|
|
1135
|
+
jest.spyOn(console, 'error').mockImplementation();
|
|
1136
|
+
var onSortChange = jest.fn();
|
|
1137
|
+
getCombinedTable({
|
|
1138
|
+
onSortChange: onSortChange,
|
|
1139
|
+
sortDescriptor: {
|
|
1140
|
+
column: 'name',
|
|
1141
|
+
direction: 'ascending'
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
var columnheaders = _react2.screen.getAllByRole('columnheader');
|
|
1145
|
+
var slider = (0, _react2.within)(columnheaders[0]).getByRole('slider', {
|
|
1146
|
+
name: /Name column width/i
|
|
1147
|
+
});
|
|
1148
|
+
(0, _react2.act)(function () {
|
|
1149
|
+
slider.focus();
|
|
1150
|
+
});
|
|
1151
|
+
_react2.fireEvent.keyDown(slider, {
|
|
1152
|
+
key: 'Enter'
|
|
1153
|
+
});
|
|
1154
|
+
_react2.fireEvent.keyDown(slider, {
|
|
1155
|
+
key: 'ArrowRight'
|
|
1156
|
+
});
|
|
1157
|
+
_react2.fireEvent.keyDown(slider, {
|
|
1158
|
+
key: 'Escape'
|
|
1159
|
+
});
|
|
1160
|
+
expect(columnheaders[0]).toHaveAttribute('aria-sort', 'ascending');
|
|
1161
|
+
expect(onSortChange).not.toHaveBeenCalled();
|
|
1162
|
+
});
|
|
1353
1163
|
});
|
|
1354
1164
|
describe('Sortable Table with useAsyncList', function () {
|
|
1355
1165
|
var dataTestId = 'sortableTable';
|
|
@@ -1363,18 +1173,18 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1363
1173
|
return _load.apply(this, arguments);
|
|
1364
1174
|
}
|
|
1365
1175
|
function _load() {
|
|
1366
|
-
_load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1367
|
-
return _regeneratorRuntime().wrap(function
|
|
1368
|
-
while (1) switch (
|
|
1176
|
+
_load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1177
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context26) {
|
|
1178
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1369
1179
|
case 0:
|
|
1370
|
-
return
|
|
1180
|
+
return _context26.abrupt("return", {
|
|
1371
1181
|
items: objects
|
|
1372
1182
|
});
|
|
1373
1183
|
case 1:
|
|
1374
1184
|
case "end":
|
|
1375
|
-
return
|
|
1185
|
+
return _context26.stop();
|
|
1376
1186
|
}
|
|
1377
|
-
},
|
|
1187
|
+
}, _callee22);
|
|
1378
1188
|
}));
|
|
1379
1189
|
return _load.apply(this, arguments);
|
|
1380
1190
|
}
|
|
@@ -1382,13 +1192,13 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1382
1192
|
return _sort.apply(this, arguments);
|
|
1383
1193
|
}
|
|
1384
1194
|
function _sort() {
|
|
1385
|
-
_sort = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1386
|
-
var
|
|
1387
|
-
return _regeneratorRuntime().wrap(function
|
|
1388
|
-
while (1) switch (
|
|
1195
|
+
_sort = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(list) {
|
|
1196
|
+
var _context27;
|
|
1197
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context28) {
|
|
1198
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1389
1199
|
case 0:
|
|
1390
1200
|
// eslint-disable-next-line no-param-reassign
|
|
1391
|
-
list.items = (0, _sort2["default"])(
|
|
1201
|
+
list.items = (0, _sort2["default"])(_context27 = list.items).call(_context27, function (a, b) {
|
|
1392
1202
|
var first = a[list.sortDescriptor.column];
|
|
1393
1203
|
var second = b[list.sortDescriptor.column];
|
|
1394
1204
|
var cmp = ((0, _parseInt2["default"])(first) || first) < ((0, _parseInt2["default"])(second) || second) // eslint-disable-line
|
|
@@ -1398,17 +1208,17 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1398
1208
|
}
|
|
1399
1209
|
return cmp;
|
|
1400
1210
|
});
|
|
1401
|
-
return
|
|
1211
|
+
return _context28.abrupt("return", list);
|
|
1402
1212
|
case 2:
|
|
1403
1213
|
case "end":
|
|
1404
|
-
return
|
|
1214
|
+
return _context28.stop();
|
|
1405
1215
|
}
|
|
1406
|
-
},
|
|
1216
|
+
}, _callee23);
|
|
1407
1217
|
}));
|
|
1408
1218
|
return _sort.apply(this, arguments);
|
|
1409
1219
|
}
|
|
1410
|
-
var sortableDataTable = function sortableDataTable(
|
|
1411
|
-
var result =
|
|
1220
|
+
var sortableDataTable = function sortableDataTable(_ref14) {
|
|
1221
|
+
var result = _ref14.result;
|
|
1412
1222
|
return (0, _react2.render)((0, _react3.jsx)(_TableBase["default"], (0, _extends2["default"])({}, defaultTableProps, {
|
|
1413
1223
|
sortDescriptor: result.current.sortDescriptor
|
|
1414
1224
|
}), (0, _react3.jsx)(_index.THead, {
|
|
@@ -1425,10 +1235,10 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1425
1235
|
});
|
|
1426
1236
|
})));
|
|
1427
1237
|
};
|
|
1428
|
-
test('sort by country column A => Z', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1238
|
+
test('sort by country column A => Z', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1429
1239
|
var _renderHook, result, sortableTable, rowgroups, thead, headerCells, tRows;
|
|
1430
|
-
return _regeneratorRuntime().wrap(function
|
|
1431
|
-
while (1) switch (
|
|
1240
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context20) {
|
|
1241
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1432
1242
|
case 0:
|
|
1433
1243
|
_renderHook = (0, _react2.renderHook)(function () {
|
|
1434
1244
|
return (0, _reactStately.useAsyncList)({
|
|
@@ -1440,47 +1250,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1440
1250
|
}
|
|
1441
1251
|
});
|
|
1442
1252
|
}), result = _renderHook.result;
|
|
1443
|
-
|
|
1444
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1445
|
-
return _regeneratorRuntime().wrap(function
|
|
1446
|
-
while (1) switch (
|
|
1253
|
+
_context20.next = 3;
|
|
1254
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1255
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context16) {
|
|
1256
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1447
1257
|
case 0:
|
|
1448
1258
|
jest.runOnlyPendingTimers();
|
|
1449
1259
|
case 1:
|
|
1450
1260
|
case "end":
|
|
1451
|
-
return
|
|
1261
|
+
return _context16.stop();
|
|
1452
1262
|
}
|
|
1453
|
-
},
|
|
1263
|
+
}, _callee14);
|
|
1454
1264
|
})));
|
|
1455
1265
|
case 3:
|
|
1456
|
-
|
|
1457
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1458
|
-
var
|
|
1459
|
-
return _regeneratorRuntime().wrap(function
|
|
1460
|
-
while (1) switch (
|
|
1266
|
+
_context20.next = 5;
|
|
1267
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1268
|
+
var _context17;
|
|
1269
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context18) {
|
|
1270
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1461
1271
|
case 0:
|
|
1462
|
-
(0, _sort2["default"])(
|
|
1272
|
+
(0, _sort2["default"])(_context17 = result.current).call(_context17, {
|
|
1463
1273
|
column: 'country',
|
|
1464
1274
|
direction: 'ascending'
|
|
1465
1275
|
});
|
|
1466
1276
|
case 1:
|
|
1467
1277
|
case "end":
|
|
1468
|
-
return
|
|
1278
|
+
return _context18.stop();
|
|
1469
1279
|
}
|
|
1470
|
-
},
|
|
1280
|
+
}, _callee15);
|
|
1471
1281
|
})));
|
|
1472
1282
|
case 5:
|
|
1473
|
-
|
|
1474
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1475
|
-
return _regeneratorRuntime().wrap(function
|
|
1476
|
-
while (1) switch (
|
|
1283
|
+
_context20.next = 7;
|
|
1284
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1285
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context19) {
|
|
1286
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1477
1287
|
case 0:
|
|
1478
1288
|
jest.runOnlyPendingTimers();
|
|
1479
1289
|
case 1:
|
|
1480
1290
|
case "end":
|
|
1481
|
-
return
|
|
1291
|
+
return _context19.stop();
|
|
1482
1292
|
}
|
|
1483
|
-
},
|
|
1293
|
+
}, _callee16);
|
|
1484
1294
|
})));
|
|
1485
1295
|
case 7:
|
|
1486
1296
|
sortableDataTable({
|
|
@@ -1508,14 +1318,14 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1508
1318
|
expect(tRows[3]).toHaveTextContent('USA');
|
|
1509
1319
|
case 28:
|
|
1510
1320
|
case "end":
|
|
1511
|
-
return
|
|
1321
|
+
return _context20.stop();
|
|
1512
1322
|
}
|
|
1513
|
-
},
|
|
1323
|
+
}, _callee17);
|
|
1514
1324
|
})));
|
|
1515
|
-
test('sort by country column Z => A', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1325
|
+
test('sort by country column Z => A', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1516
1326
|
var _renderHook2, result, sortableTable, rowgroups, tRows;
|
|
1517
|
-
return _regeneratorRuntime().wrap(function
|
|
1518
|
-
while (1) switch (
|
|
1327
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context25) {
|
|
1328
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1519
1329
|
case 0:
|
|
1520
1330
|
_renderHook2 = (0, _react2.renderHook)(function () {
|
|
1521
1331
|
return (0, _reactStately.useAsyncList)({
|
|
@@ -1527,47 +1337,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1527
1337
|
}
|
|
1528
1338
|
});
|
|
1529
1339
|
}), result = _renderHook2.result;
|
|
1530
|
-
|
|
1531
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1532
|
-
return _regeneratorRuntime().wrap(function
|
|
1533
|
-
while (1) switch (
|
|
1340
|
+
_context25.next = 3;
|
|
1341
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1342
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context21) {
|
|
1343
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1534
1344
|
case 0:
|
|
1535
1345
|
jest.runOnlyPendingTimers();
|
|
1536
1346
|
case 1:
|
|
1537
1347
|
case "end":
|
|
1538
|
-
return
|
|
1348
|
+
return _context21.stop();
|
|
1539
1349
|
}
|
|
1540
|
-
},
|
|
1350
|
+
}, _callee18);
|
|
1541
1351
|
})));
|
|
1542
1352
|
case 3:
|
|
1543
|
-
|
|
1544
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1545
|
-
var
|
|
1546
|
-
return _regeneratorRuntime().wrap(function
|
|
1547
|
-
while (1) switch (
|
|
1353
|
+
_context25.next = 5;
|
|
1354
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1355
|
+
var _context22;
|
|
1356
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context23) {
|
|
1357
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1548
1358
|
case 0:
|
|
1549
|
-
(0, _sort2["default"])(
|
|
1359
|
+
(0, _sort2["default"])(_context22 = result.current).call(_context22, {
|
|
1550
1360
|
column: 'country',
|
|
1551
1361
|
direction: 'descending'
|
|
1552
1362
|
});
|
|
1553
1363
|
case 1:
|
|
1554
1364
|
case "end":
|
|
1555
|
-
return
|
|
1365
|
+
return _context23.stop();
|
|
1556
1366
|
}
|
|
1557
|
-
},
|
|
1367
|
+
}, _callee19);
|
|
1558
1368
|
})));
|
|
1559
1369
|
case 5:
|
|
1560
|
-
|
|
1561
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1562
|
-
return _regeneratorRuntime().wrap(function
|
|
1563
|
-
while (1) switch (
|
|
1370
|
+
_context25.next = 7;
|
|
1371
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1372
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context24) {
|
|
1373
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1564
1374
|
case 0:
|
|
1565
1375
|
jest.runOnlyPendingTimers();
|
|
1566
1376
|
case 1:
|
|
1567
1377
|
case "end":
|
|
1568
|
-
return
|
|
1378
|
+
return _context24.stop();
|
|
1569
1379
|
}
|
|
1570
|
-
},
|
|
1380
|
+
}, _callee20);
|
|
1571
1381
|
})));
|
|
1572
1382
|
case 7:
|
|
1573
1383
|
sortableDataTable({
|
|
@@ -1591,8 +1401,8 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1591
1401
|
expect(tRows[3]).toHaveTextContent('Canada');
|
|
1592
1402
|
case 24:
|
|
1593
1403
|
case "end":
|
|
1594
|
-
return
|
|
1404
|
+
return _context25.stop();
|
|
1595
1405
|
}
|
|
1596
|
-
},
|
|
1406
|
+
}, _callee21);
|
|
1597
1407
|
})));
|
|
1598
1408
|
});
|