@linzjs/step-ag-grid 7.11.0 → 7.11.2
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/README.md +48 -1
- package/dist/index.js +39 -25
- package/dist/index.js.map +1 -1
- package/dist/step-ag-grid.esm.js +39 -25
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +6 -1
- package/src/utils/testUtil.ts +12 -8
package/package.json
CHANGED
package/src/components/Grid.tsx
CHANGED
|
@@ -285,7 +285,12 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
285
285
|
return (
|
|
286
286
|
<div
|
|
287
287
|
data-testid={params["data-testid"]}
|
|
288
|
-
className={clsx(
|
|
288
|
+
className={clsx(
|
|
289
|
+
"Grid-container",
|
|
290
|
+
"ag-theme-alpine",
|
|
291
|
+
staleGrid && "Grid-sortIsStale",
|
|
292
|
+
gridReady && params.rowData && "Grid-ready",
|
|
293
|
+
)}
|
|
289
294
|
>
|
|
290
295
|
{params.quickFilter && (
|
|
291
296
|
<div className="Grid-quickFilter">
|
package/src/utils/testUtil.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { act, waitFor, within } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
3
|
import { findQuick, getAllQuick, getMatcher, getQuick, queryQuick } from "./testQuick";
|
|
4
|
-
import { wait } from "./util";
|
|
5
4
|
|
|
6
5
|
export const countRows = async (within?: HTMLElement): Promise<number> => {
|
|
7
6
|
return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
|
|
@@ -22,9 +21,15 @@ const _selectRow = async (
|
|
|
22
21
|
): Promise<void> => {
|
|
23
22
|
await act(async () => {
|
|
24
23
|
const row = await findRow(rowId, within);
|
|
25
|
-
const isSelected =
|
|
24
|
+
const isSelected = row.className.includes("ag-row-selected");
|
|
26
25
|
if (select === "toggle" || (select === "select" && !isSelected) || (select === "deselect" && isSelected)) {
|
|
27
|
-
|
|
26
|
+
const cell = await findCell(rowId, "selection", within);
|
|
27
|
+
userEvent.click(cell);
|
|
28
|
+
await waitFor(async () => {
|
|
29
|
+
const row = await findRow(rowId, within);
|
|
30
|
+
const nowSelected = row.className.includes("ag-row-selected");
|
|
31
|
+
if (nowSelected == isSelected) throw `Row ${rowId} won't select`;
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
34
|
});
|
|
30
35
|
};
|
|
@@ -67,7 +72,7 @@ export const editCell = async (rowId: number | string, colId: string, within?: H
|
|
|
67
72
|
const cell = await findCell(rowId, colId, within);
|
|
68
73
|
userEvent.dblClick(cell);
|
|
69
74
|
});
|
|
70
|
-
await findOpenMenu
|
|
75
|
+
await waitFor(findOpenMenu);
|
|
71
76
|
};
|
|
72
77
|
|
|
73
78
|
const findOpenMenu = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
|
|
@@ -89,14 +94,14 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
|
|
|
89
94
|
}
|
|
90
95
|
return menuOption;
|
|
91
96
|
},
|
|
92
|
-
{ timeout:
|
|
97
|
+
{ timeout: 5000 },
|
|
93
98
|
);
|
|
94
99
|
};
|
|
95
100
|
|
|
96
101
|
export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
|
|
102
|
+
const menuOption = await findMenuOption(menuOptionText);
|
|
97
103
|
await act(async () => {
|
|
98
|
-
|
|
99
|
-
menuOption && userEvent.click(menuOption);
|
|
104
|
+
userEvent.click(menuOption);
|
|
100
105
|
});
|
|
101
106
|
};
|
|
102
107
|
|
|
@@ -107,7 +112,6 @@ export const openAndClickMenuOption = async (
|
|
|
107
112
|
within?: HTMLElement,
|
|
108
113
|
): Promise<void> => {
|
|
109
114
|
await editCell(rowId, colId, within);
|
|
110
|
-
await wait(100);
|
|
111
115
|
await clickMenuOption(menuOptionText);
|
|
112
116
|
};
|
|
113
117
|
|