@pingux/astro 2.214.0 → 2.216.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/OverlayPanel/OverlayPanel.js +6 -0
- package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +64 -0
- package/lib/cjs/components/Table/Table.mdx +2 -3
- package/lib/cjs/components/TableBase/Convenience/TableBaseEmptyState.stories.js +73 -0
- package/lib/cjs/components/TableBase/Customization/CustomEmptyState.stories.js +62 -0
- package/lib/cjs/components/TableBase/TableBase.js +179 -37
- package/lib/cjs/components/TableBase/TableBase.stories.js +217 -26
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +3 -0
- package/lib/cjs/components/TableBase/TableBase.styles.js +3 -0
- package/lib/cjs/components/TableBase/TableBase.test.js +557 -66
- package/lib/cjs/components/TableBase/TableBaseEmptyState.d.ts +4 -0
- package/lib/cjs/components/TableBase/TableBaseEmptyState.js +72 -0
- package/lib/cjs/components/TableBase/TableBaseEmptyState.test.js +54 -0
- package/lib/cjs/components/TableBase/index.d.ts +1 -0
- package/lib/cjs/components/TableBase/index.js +8 -1
- package/lib/cjs/components/TableBase/tableBaseAttributes.d.ts +21 -0
- package/lib/cjs/components/TableBase/tableBaseAttributes.js +24 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/types/tableBase.d.ts +16 -1
- package/lib/components/OverlayPanel/OverlayPanel.js +7 -1
- package/lib/components/OverlayPanel/OverlayPanel.test.js +64 -0
- package/lib/components/Table/Table.mdx +2 -3
- package/lib/components/TableBase/Convenience/TableBaseEmptyState.stories.js +65 -0
- package/lib/components/TableBase/Customization/CustomEmptyState.stories.js +54 -0
- package/lib/components/TableBase/TableBase.js +179 -35
- package/lib/components/TableBase/TableBase.stories.js +220 -28
- package/lib/components/TableBase/TableBase.styles.js +3 -0
- package/lib/components/TableBase/TableBase.test.js +557 -66
- package/lib/components/TableBase/TableBaseEmptyState.js +60 -0
- package/lib/components/TableBase/TableBaseEmptyState.test.js +51 -0
- package/lib/components/TableBase/index.js +2 -1
- package/lib/components/TableBase/tableBaseAttributes.js +23 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ 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"));
|
|
17
18
|
var _sort2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
18
19
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
|
19
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
@@ -559,6 +560,101 @@ test('Arrow Left move the focus to next cell', /*#__PURE__*/(0, _asyncToGenerato
|
|
|
559
560
|
}
|
|
560
561
|
}, _callee10);
|
|
561
562
|
})));
|
|
563
|
+
var renderWithLoadingState = function renderWithLoadingState(loadingState) {
|
|
564
|
+
return (0, _react2.render)((0, _react3.jsx)(_TableBase["default"], {
|
|
565
|
+
"aria-label": "table",
|
|
566
|
+
loadingState: loadingState
|
|
567
|
+
}, (0, _react3.jsx)(_index.THead, {
|
|
568
|
+
columns: headers
|
|
569
|
+
}, function (head) {
|
|
570
|
+
return (0, _react3.jsx)(_index.Column, {
|
|
571
|
+
key: head.key
|
|
572
|
+
}, head.name);
|
|
573
|
+
}), (0, _react3.jsx)(_index.TBody, {
|
|
574
|
+
items: []
|
|
575
|
+
}, function () {
|
|
576
|
+
return (0, _react3.jsx)(_index.Row, null, (0, _react3.jsx)(_index.Cell, null, "A"), (0, _react3.jsx)(_index.Cell, null, "B"), (0, _react3.jsx)(_index.Cell, null, "C"));
|
|
577
|
+
})));
|
|
578
|
+
};
|
|
579
|
+
describe('Loading state', function () {
|
|
580
|
+
test('renders Loader when loadingState is "loading"', function () {
|
|
581
|
+
renderWithLoadingState('loading');
|
|
582
|
+
expect(_react2.screen.getByRole('alert')).toBeInTheDocument();
|
|
583
|
+
});
|
|
584
|
+
test('renders Loader when loadingState is "sorting"', function () {
|
|
585
|
+
renderWithLoadingState('sorting');
|
|
586
|
+
expect(_react2.screen.getByRole('alert')).toBeInTheDocument();
|
|
587
|
+
});
|
|
588
|
+
test('does not render Loader when loadingState is absent', function () {
|
|
589
|
+
renderWithLoadingState();
|
|
590
|
+
expect(_react2.screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
591
|
+
});
|
|
592
|
+
test('does not render Loader when loadingState is "loadingMore", renders empty state instead (Constraint #6)', function () {
|
|
593
|
+
renderWithLoadingState('loadingMore');
|
|
594
|
+
expect(_react2.screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
595
|
+
expect(_react2.screen.getByText('No items exist')).toBeInTheDocument();
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
describe('Empty state', function () {
|
|
599
|
+
test('renders default empty state when items is empty and no loadingState', function () {
|
|
600
|
+
(0, _react2.render)((0, _react3.jsx)(_TableBase["default"], {
|
|
601
|
+
"aria-label": "table"
|
|
602
|
+
}, (0, _react3.jsx)(_index.THead, {
|
|
603
|
+
columns: headers
|
|
604
|
+
}, function (head) {
|
|
605
|
+
return (0, _react3.jsx)(_index.Column, {
|
|
606
|
+
key: head.key
|
|
607
|
+
}, head.name);
|
|
608
|
+
}), (0, _react3.jsx)(_index.TBody, {
|
|
609
|
+
items: []
|
|
610
|
+
}, function () {
|
|
611
|
+
return (0, _react3.jsx)(_index.Row, null, (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null));
|
|
612
|
+
})));
|
|
613
|
+
expect(_react2.screen.getByText('No items exist')).toBeInTheDocument();
|
|
614
|
+
});
|
|
615
|
+
test('renders custom renderEmptyState and not default empty state', function () {
|
|
616
|
+
(0, _react2.render)((0, _react3.jsx)(_TableBase["default"], {
|
|
617
|
+
"aria-label": "table",
|
|
618
|
+
renderEmptyState: function renderEmptyState() {
|
|
619
|
+
return (0, _react3.jsx)("div", null, "Custom");
|
|
620
|
+
}
|
|
621
|
+
}, (0, _react3.jsx)(_index.THead, {
|
|
622
|
+
columns: headers
|
|
623
|
+
}, function (head) {
|
|
624
|
+
return (0, _react3.jsx)(_index.Column, {
|
|
625
|
+
key: head.key
|
|
626
|
+
}, head.name);
|
|
627
|
+
}), (0, _react3.jsx)(_index.TBody, {
|
|
628
|
+
items: []
|
|
629
|
+
}, function () {
|
|
630
|
+
return (0, _react3.jsx)(_index.Row, null, (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null));
|
|
631
|
+
})));
|
|
632
|
+
expect(_react2.screen.getByText('Custom')).toBeInTheDocument();
|
|
633
|
+
expect(_react2.screen.queryByText('No items exist')).not.toBeInTheDocument();
|
|
634
|
+
});
|
|
635
|
+
test('renders Loader and not empty state when loadingState is "loading" and items is empty', function () {
|
|
636
|
+
(0, _react2.render)((0, _react3.jsx)(_TableBase["default"], {
|
|
637
|
+
"aria-label": "table",
|
|
638
|
+
loadingState: "loading",
|
|
639
|
+
renderEmptyState: function renderEmptyState() {
|
|
640
|
+
return (0, _react3.jsx)("div", null, "Custom");
|
|
641
|
+
}
|
|
642
|
+
}, (0, _react3.jsx)(_index.THead, {
|
|
643
|
+
columns: headers
|
|
644
|
+
}, function (head) {
|
|
645
|
+
return (0, _react3.jsx)(_index.Column, {
|
|
646
|
+
key: head.key
|
|
647
|
+
}, head.name);
|
|
648
|
+
}), (0, _react3.jsx)(_index.TBody, {
|
|
649
|
+
items: []
|
|
650
|
+
}, function () {
|
|
651
|
+
return (0, _react3.jsx)(_index.Row, null, (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null), (0, _react3.jsx)(_index.Cell, null));
|
|
652
|
+
})));
|
|
653
|
+
expect(_react2.screen.getByRole('alert')).toBeInTheDocument();
|
|
654
|
+
expect(_react2.screen.queryByText('Custom')).not.toBeInTheDocument();
|
|
655
|
+
expect(_react2.screen.queryByText('No items exist')).not.toBeInTheDocument();
|
|
656
|
+
});
|
|
657
|
+
});
|
|
562
658
|
describe('Resizable columns', function () {
|
|
563
659
|
var resizableHeaders = [{
|
|
564
660
|
key: 'name',
|
|
@@ -860,6 +956,401 @@ describe('Resizable columns', function () {
|
|
|
860
956
|
});
|
|
861
957
|
});
|
|
862
958
|
});
|
|
959
|
+
describe('onRowAction behavior', function () {
|
|
960
|
+
test('clicking a cell fires onRowAction with the correct row key', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
961
|
+
var onRowAction, rows, firstBodyRowCells;
|
|
962
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context14) {
|
|
963
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
964
|
+
case 0:
|
|
965
|
+
onRowAction = jest.fn();
|
|
966
|
+
getComponent({
|
|
967
|
+
onRowAction: onRowAction
|
|
968
|
+
});
|
|
969
|
+
rows = _react2.screen.getAllByRole('row');
|
|
970
|
+
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
971
|
+
_context14.next = 6;
|
|
972
|
+
return _userEvent["default"].click(firstBodyRowCells[0]);
|
|
973
|
+
case 6:
|
|
974
|
+
expect(onRowAction).toHaveBeenCalledTimes(1);
|
|
975
|
+
expect(onRowAction).toHaveBeenCalledWith('1');
|
|
976
|
+
case 8:
|
|
977
|
+
case "end":
|
|
978
|
+
return _context14.stop();
|
|
979
|
+
}
|
|
980
|
+
}, _callee12);
|
|
981
|
+
})));
|
|
982
|
+
test('rows receive has-actions class when onRowAction is provided', function () {
|
|
983
|
+
var _context15;
|
|
984
|
+
var onRowAction = jest.fn();
|
|
985
|
+
getComponent({
|
|
986
|
+
onRowAction: onRowAction
|
|
987
|
+
});
|
|
988
|
+
var rows = _react2.screen.getAllByRole('row');
|
|
989
|
+
|
|
990
|
+
// All body rows (skip the header row at index 0) should have the has-actions class
|
|
991
|
+
(0, _forEach["default"])(_context15 = (0, _slice["default"])(rows).call(rows, 1)).call(_context15, function (row) {
|
|
992
|
+
expect(row).toHaveClass('has-actions');
|
|
993
|
+
});
|
|
994
|
+
});
|
|
995
|
+
test('rows do not receive has-actions class when onRowAction is absent', function () {
|
|
996
|
+
var _context16;
|
|
997
|
+
getComponent();
|
|
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');
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
test('pressing Enter on a focused row fires onRowAction when selectionMode is none', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1004
|
+
var onRowAction, rows;
|
|
1005
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context17) {
|
|
1006
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1007
|
+
case 0:
|
|
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();
|
|
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
|
+
});
|
|
1074
|
+
var rows = _react2.screen.getAllByRole('row');
|
|
1075
|
+
|
|
1076
|
+
// At mount time, no body row should have is-focused from active-row state
|
|
1077
|
+
(0, _forEach["default"])(_context19 = (0, _slice["default"])(rows).call(rows, 1)).call(_context19, function (row) {
|
|
1078
|
+
expect(row).not.toHaveClass('is-focused');
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1081
|
+
test('clicking a row without onRowAction does not apply is-focused', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1082
|
+
var rows, firstBodyRowCells;
|
|
1083
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context20) {
|
|
1084
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
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) {
|
|
1104
|
+
case 0:
|
|
1105
|
+
onRowAction = jest.fn();
|
|
1106
|
+
getComponent({
|
|
1107
|
+
selectionMode: 'none',
|
|
1108
|
+
onRowAction: onRowAction
|
|
1109
|
+
});
|
|
1110
|
+
rows = _react2.screen.getAllByRole('row'); // Tab into the table so the first body row has keyboard focus
|
|
1111
|
+
_context21.next = 5;
|
|
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
|
|
1255
|
+
});
|
|
1256
|
+
rows = _react2.screen.getAllByRole('row'); // Click the first body row — sets activeRowKey and fires onRowAction
|
|
1257
|
+
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1258
|
+
_context27.next = 6;
|
|
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;
|
|
1293
|
+
return _userEvent["default"].tab();
|
|
1294
|
+
case 5:
|
|
1295
|
+
expect(rows[1]).toHaveFocus();
|
|
1296
|
+
|
|
1297
|
+
// Press Enter to trigger onRowAction via keyboard
|
|
1298
|
+
_react2.fireEvent.keyDown(rows[1], {
|
|
1299
|
+
key: 'Enter'
|
|
1300
|
+
});
|
|
1301
|
+
_react2.fireEvent.keyUp(rows[1], {
|
|
1302
|
+
key: 'Enter'
|
|
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
|
|
1322
|
+
});
|
|
1323
|
+
rows = _react2.screen.getAllByRole('row'); // Click row 1 to set it as active (simulates opening a panel)
|
|
1324
|
+
firstBodyRowCells = rows[1].querySelectorAll('td');
|
|
1325
|
+
_context29.next = 6;
|
|
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'
|
|
1340
|
+
});
|
|
1341
|
+
_react2.fireEvent.keyUp(rows[1], {
|
|
1342
|
+
key: 'ArrowDown'
|
|
1343
|
+
});
|
|
1344
|
+
_react2.fireEvent.focus(rows[2]);
|
|
1345
|
+
expect(rows[1]).not.toHaveClass('is-focused');
|
|
1346
|
+
expect(rows[2]).toHaveFocus();
|
|
1347
|
+
case 14:
|
|
1348
|
+
case "end":
|
|
1349
|
+
return _context29.stop();
|
|
1350
|
+
}
|
|
1351
|
+
}, _callee23);
|
|
1352
|
+
})));
|
|
1353
|
+
});
|
|
863
1354
|
describe('Sortable Table with useAsyncList', function () {
|
|
864
1355
|
var dataTestId = 'sortableTable';
|
|
865
1356
|
var defaultTableProps = {
|
|
@@ -872,18 +1363,18 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
872
1363
|
return _load.apply(this, arguments);
|
|
873
1364
|
}
|
|
874
1365
|
function _load() {
|
|
875
|
-
_load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
876
|
-
return _regeneratorRuntime().wrap(function
|
|
877
|
-
while (1) switch (
|
|
1366
|
+
_load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1367
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context40) {
|
|
1368
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
878
1369
|
case 0:
|
|
879
|
-
return
|
|
1370
|
+
return _context40.abrupt("return", {
|
|
880
1371
|
items: objects
|
|
881
1372
|
});
|
|
882
1373
|
case 1:
|
|
883
1374
|
case "end":
|
|
884
|
-
return
|
|
1375
|
+
return _context40.stop();
|
|
885
1376
|
}
|
|
886
|
-
},
|
|
1377
|
+
}, _callee32);
|
|
887
1378
|
}));
|
|
888
1379
|
return _load.apply(this, arguments);
|
|
889
1380
|
}
|
|
@@ -891,13 +1382,13 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
891
1382
|
return _sort.apply(this, arguments);
|
|
892
1383
|
}
|
|
893
1384
|
function _sort() {
|
|
894
|
-
_sort = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
895
|
-
var
|
|
896
|
-
return _regeneratorRuntime().wrap(function
|
|
897
|
-
while (1) switch (
|
|
1385
|
+
_sort = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(list) {
|
|
1386
|
+
var _context41;
|
|
1387
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context42) {
|
|
1388
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
898
1389
|
case 0:
|
|
899
1390
|
// eslint-disable-next-line no-param-reassign
|
|
900
|
-
list.items = (0, _sort2["default"])(
|
|
1391
|
+
list.items = (0, _sort2["default"])(_context41 = list.items).call(_context41, function (a, b) {
|
|
901
1392
|
var first = a[list.sortDescriptor.column];
|
|
902
1393
|
var second = b[list.sortDescriptor.column];
|
|
903
1394
|
var cmp = ((0, _parseInt2["default"])(first) || first) < ((0, _parseInt2["default"])(second) || second) // eslint-disable-line
|
|
@@ -907,17 +1398,17 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
907
1398
|
}
|
|
908
1399
|
return cmp;
|
|
909
1400
|
});
|
|
910
|
-
return
|
|
1401
|
+
return _context42.abrupt("return", list);
|
|
911
1402
|
case 2:
|
|
912
1403
|
case "end":
|
|
913
|
-
return
|
|
1404
|
+
return _context42.stop();
|
|
914
1405
|
}
|
|
915
|
-
},
|
|
1406
|
+
}, _callee33);
|
|
916
1407
|
}));
|
|
917
1408
|
return _sort.apply(this, arguments);
|
|
918
1409
|
}
|
|
919
|
-
var sortableDataTable = function sortableDataTable(
|
|
920
|
-
var result =
|
|
1410
|
+
var sortableDataTable = function sortableDataTable(_ref24) {
|
|
1411
|
+
var result = _ref24.result;
|
|
921
1412
|
return (0, _react2.render)((0, _react3.jsx)(_TableBase["default"], (0, _extends2["default"])({}, defaultTableProps, {
|
|
922
1413
|
sortDescriptor: result.current.sortDescriptor
|
|
923
1414
|
}), (0, _react3.jsx)(_index.THead, {
|
|
@@ -934,10 +1425,10 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
934
1425
|
});
|
|
935
1426
|
})));
|
|
936
1427
|
};
|
|
937
|
-
test('sort by country column A => Z', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1428
|
+
test('sort by country column A => Z', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
938
1429
|
var _renderHook, result, sortableTable, rowgroups, thead, headerCells, tRows;
|
|
939
|
-
return _regeneratorRuntime().wrap(function
|
|
940
|
-
while (1) switch (
|
|
1430
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context34) {
|
|
1431
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
941
1432
|
case 0:
|
|
942
1433
|
_renderHook = (0, _react2.renderHook)(function () {
|
|
943
1434
|
return (0, _reactStately.useAsyncList)({
|
|
@@ -949,47 +1440,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
949
1440
|
}
|
|
950
1441
|
});
|
|
951
1442
|
}), result = _renderHook.result;
|
|
952
|
-
|
|
953
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
954
|
-
return _regeneratorRuntime().wrap(function
|
|
955
|
-
while (1) switch (
|
|
1443
|
+
_context34.next = 3;
|
|
1444
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1445
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context30) {
|
|
1446
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
956
1447
|
case 0:
|
|
957
1448
|
jest.runOnlyPendingTimers();
|
|
958
1449
|
case 1:
|
|
959
1450
|
case "end":
|
|
960
|
-
return
|
|
1451
|
+
return _context30.stop();
|
|
961
1452
|
}
|
|
962
|
-
},
|
|
1453
|
+
}, _callee24);
|
|
963
1454
|
})));
|
|
964
1455
|
case 3:
|
|
965
|
-
|
|
966
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
967
|
-
var
|
|
968
|
-
return _regeneratorRuntime().wrap(function
|
|
969
|
-
while (1) switch (
|
|
1456
|
+
_context34.next = 5;
|
|
1457
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1458
|
+
var _context31;
|
|
1459
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context32) {
|
|
1460
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
970
1461
|
case 0:
|
|
971
|
-
(0, _sort2["default"])(
|
|
1462
|
+
(0, _sort2["default"])(_context31 = result.current).call(_context31, {
|
|
972
1463
|
column: 'country',
|
|
973
1464
|
direction: 'ascending'
|
|
974
1465
|
});
|
|
975
1466
|
case 1:
|
|
976
1467
|
case "end":
|
|
977
|
-
return
|
|
1468
|
+
return _context32.stop();
|
|
978
1469
|
}
|
|
979
|
-
},
|
|
1470
|
+
}, _callee25);
|
|
980
1471
|
})));
|
|
981
1472
|
case 5:
|
|
982
|
-
|
|
983
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
984
|
-
return _regeneratorRuntime().wrap(function
|
|
985
|
-
while (1) switch (
|
|
1473
|
+
_context34.next = 7;
|
|
1474
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1475
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context33) {
|
|
1476
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
986
1477
|
case 0:
|
|
987
1478
|
jest.runOnlyPendingTimers();
|
|
988
1479
|
case 1:
|
|
989
1480
|
case "end":
|
|
990
|
-
return
|
|
1481
|
+
return _context33.stop();
|
|
991
1482
|
}
|
|
992
|
-
},
|
|
1483
|
+
}, _callee26);
|
|
993
1484
|
})));
|
|
994
1485
|
case 7:
|
|
995
1486
|
sortableDataTable({
|
|
@@ -1017,14 +1508,14 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1017
1508
|
expect(tRows[3]).toHaveTextContent('USA');
|
|
1018
1509
|
case 28:
|
|
1019
1510
|
case "end":
|
|
1020
|
-
return
|
|
1511
|
+
return _context34.stop();
|
|
1021
1512
|
}
|
|
1022
|
-
},
|
|
1513
|
+
}, _callee27);
|
|
1023
1514
|
})));
|
|
1024
|
-
test('sort by country column Z => A', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1515
|
+
test('sort by country column Z => A', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1025
1516
|
var _renderHook2, result, sortableTable, rowgroups, tRows;
|
|
1026
|
-
return _regeneratorRuntime().wrap(function
|
|
1027
|
-
while (1) switch (
|
|
1517
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context39) {
|
|
1518
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1028
1519
|
case 0:
|
|
1029
1520
|
_renderHook2 = (0, _react2.renderHook)(function () {
|
|
1030
1521
|
return (0, _reactStately.useAsyncList)({
|
|
@@ -1036,47 +1527,47 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1036
1527
|
}
|
|
1037
1528
|
});
|
|
1038
1529
|
}), result = _renderHook2.result;
|
|
1039
|
-
|
|
1040
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1041
|
-
return _regeneratorRuntime().wrap(function
|
|
1042
|
-
while (1) switch (
|
|
1530
|
+
_context39.next = 3;
|
|
1531
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1532
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context35) {
|
|
1533
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1043
1534
|
case 0:
|
|
1044
1535
|
jest.runOnlyPendingTimers();
|
|
1045
1536
|
case 1:
|
|
1046
1537
|
case "end":
|
|
1047
|
-
return
|
|
1538
|
+
return _context35.stop();
|
|
1048
1539
|
}
|
|
1049
|
-
},
|
|
1540
|
+
}, _callee28);
|
|
1050
1541
|
})));
|
|
1051
1542
|
case 3:
|
|
1052
|
-
|
|
1053
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1054
|
-
var
|
|
1055
|
-
return _regeneratorRuntime().wrap(function
|
|
1056
|
-
while (1) switch (
|
|
1543
|
+
_context39.next = 5;
|
|
1544
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1545
|
+
var _context36;
|
|
1546
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context37) {
|
|
1547
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1057
1548
|
case 0:
|
|
1058
|
-
(0, _sort2["default"])(
|
|
1549
|
+
(0, _sort2["default"])(_context36 = result.current).call(_context36, {
|
|
1059
1550
|
column: 'country',
|
|
1060
1551
|
direction: 'descending'
|
|
1061
1552
|
});
|
|
1062
1553
|
case 1:
|
|
1063
1554
|
case "end":
|
|
1064
|
-
return
|
|
1555
|
+
return _context37.stop();
|
|
1065
1556
|
}
|
|
1066
|
-
},
|
|
1557
|
+
}, _callee29);
|
|
1067
1558
|
})));
|
|
1068
1559
|
case 5:
|
|
1069
|
-
|
|
1070
|
-
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1071
|
-
return _regeneratorRuntime().wrap(function
|
|
1072
|
-
while (1) switch (
|
|
1560
|
+
_context39.next = 7;
|
|
1561
|
+
return (0, _react2.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1562
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context38) {
|
|
1563
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1073
1564
|
case 0:
|
|
1074
1565
|
jest.runOnlyPendingTimers();
|
|
1075
1566
|
case 1:
|
|
1076
1567
|
case "end":
|
|
1077
|
-
return
|
|
1568
|
+
return _context38.stop();
|
|
1078
1569
|
}
|
|
1079
|
-
},
|
|
1570
|
+
}, _callee30);
|
|
1080
1571
|
})));
|
|
1081
1572
|
case 7:
|
|
1082
1573
|
sortableDataTable({
|
|
@@ -1100,8 +1591,8 @@ describe('Sortable Table with useAsyncList', function () {
|
|
|
1100
1591
|
expect(tRows[3]).toHaveTextContent('Canada');
|
|
1101
1592
|
case 24:
|
|
1102
1593
|
case "end":
|
|
1103
|
-
return
|
|
1594
|
+
return _context39.stop();
|
|
1104
1595
|
}
|
|
1105
|
-
},
|
|
1596
|
+
}, _callee31);
|
|
1106
1597
|
})));
|
|
1107
1598
|
});
|