@linzjs/step-ag-grid 7.11.0 → 7.11.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "7.11.0",
5
+ "version": "7.11.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -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("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale")}
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">
@@ -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 = !row.className.includes("ag-row-selected");
24
+ const isSelected = row.className.includes("ag-row-selected");
26
25
  if (select === "toggle" || (select === "select" && !isSelected) || (select === "deselect" && isSelected)) {
27
- userEvent.click(row);
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
  };
@@ -63,11 +68,12 @@ export const selectCell = async (rowId: string | number, colId: string, within?:
63
68
  };
64
69
 
65
70
  export const editCell = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<void> => {
71
+ await selectRow(rowId, within);
66
72
  await act(async () => {
67
73
  const cell = await findCell(rowId, colId, within);
68
74
  userEvent.dblClick(cell);
69
75
  });
70
- await findOpenMenu();
76
+ await waitFor(findOpenMenu);
71
77
  };
72
78
 
73
79
  const findOpenMenu = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
@@ -89,14 +95,14 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
89
95
  }
90
96
  return menuOption;
91
97
  },
92
- { timeout: 10000 },
98
+ { timeout: 5000 },
93
99
  );
94
100
  };
95
101
 
96
102
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
103
+ const menuOption = await findMenuOption(menuOptionText);
97
104
  await act(async () => {
98
- const menuOption = await findMenuOption(menuOptionText);
99
- menuOption && userEvent.click(menuOption);
105
+ userEvent.click(menuOption);
100
106
  });
101
107
  };
102
108
 
@@ -107,7 +113,6 @@ export const openAndClickMenuOption = async (
107
113
  within?: HTMLElement,
108
114
  ): Promise<void> => {
109
115
  await editCell(rowId, colId, within);
110
- await wait(100);
111
116
  await clickMenuOption(menuOptionText);
112
117
  };
113
118