@linzjs/step-ag-grid 7.3.1 → 7.4.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/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.3.1",
5
+ "version": "7.4.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -50,7 +50,7 @@ export const GridFormTextArea = <RowType extends GridBaseRow>(props: GridFormTex
50
50
  });
51
51
 
52
52
  return popoverWrapper(
53
- <div style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}>
53
+ <div className={"subComponent"} style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}>
54
54
  <TextAreaInput
55
55
  value={value}
56
56
  onChange={(e) => setValue(e.target.value)}
@@ -50,7 +50,10 @@ export const GridFormTextInput = <RowType extends GridBaseRow>(props: GridFormTe
50
50
  });
51
51
 
52
52
  return popoverWrapper(
53
- <div style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }} className={"FormTest"}>
53
+ <div
54
+ style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}
55
+ className={"FormTest subComponent"}
56
+ >
54
57
  <TextInputFormatted
55
58
  value={value}
56
59
  onChange={(e) => setValue(e.target.value)}
@@ -15,7 +15,7 @@ export interface GridContextType {
15
15
  selectRowsByIdWithFlash: (rowIds?: number[]) => void;
16
16
  flashRows: (rowIds?: number[]) => void;
17
17
  flashRowsDiff: (updateFn: () => Promise<any>) => Promise<void>;
18
- ensureRowVisible: (id: number) => void;
18
+ ensureRowVisible: (id: number | string) => boolean;
19
19
  ensureSelectedRowIsVisible: () => void;
20
20
  sizeColumnsToFit: () => void;
21
21
  stopEditing: () => void;
@@ -67,6 +67,7 @@ export const GridContext = createContext<GridContextType>({
67
67
  },
68
68
  ensureRowVisible: () => {
69
69
  console.error("no context provider for ensureRowVisible");
70
+ return true;
70
71
  },
71
72
  ensureSelectedRowIsVisible: () => {
72
73
  console.error("no context provider for ensureSelectedRowIsVisible");
@@ -200,10 +200,12 @@ export const GridContextProvider = (props: GridContextProps): ReactElement => {
200
200
  );
201
201
  };
202
202
 
203
- const ensureRowVisible = (id: number): void => {
204
- gridApiOp((gridApi) => {
203
+ const ensureRowVisible = (id: number | string): boolean => {
204
+ return gridApiOp((gridApi) => {
205
205
  const node = gridApi.getRowNode(`${id}`);
206
- node && gridApi.ensureNodeVisible(node);
206
+ if (!node) return false;
207
+ gridApi.ensureNodeVisible(node);
208
+ return true;
207
209
  });
208
210
  };
209
211
 
@@ -3,6 +3,10 @@ import userEvent from "@testing-library/user-event";
3
3
  import { findQuick, getAllQuick, getMatcher, getQuick, queryQuick } from "./testQuick";
4
4
  import { wait } from "./util";
5
5
 
6
+ export const countRows = async (within?: HTMLElement): Promise<number> => {
7
+ return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
8
+ };
9
+
6
10
  export const findRow = async (rowId: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
7
11
  return findQuick<HTMLDivElement>({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
8
12
  };
@@ -36,16 +40,19 @@ export const findCell = async (rowId: number | string, colId: string, within?: H
36
40
  return await findQuick({ tagName: `[col-id='${colId}']` }, row);
37
41
  };
38
42
 
39
- export const cellContains = async (
43
+ export const findCellContains = async (
40
44
  rowId: number | string,
41
45
  colId: string,
42
46
  text: string | RegExp,
43
47
  within?: HTMLElement,
44
48
  ) => {
45
- return await waitFor(async () => {
46
- const row = await findRow(rowId, within);
47
- return await findQuick({ tagName: `[col-id='${colId}']`, text }, row);
48
- });
49
+ return await waitFor(
50
+ async () => {
51
+ const row = await findRow(rowId, within);
52
+ return await findQuick({ tagName: `[col-id='${colId}']`, text }, row);
53
+ },
54
+ { timeout: 10000 },
55
+ );
49
56
  };
50
57
 
51
58
  export const selectCell = async (rowId: string | number, colId: string, within?: HTMLElement): Promise<void> => {
@@ -129,12 +136,14 @@ export const clickMultiSelectOption = async (value: string): Promise<void> => {
129
136
  export const typeOtherInput = async (value: string): Promise<void> => {
130
137
  const openMenu = await findOpenMenu();
131
138
  const otherInput = await findQuick({ classes: ".subComponent", child: { tagName: "input[type='text']" } }, openMenu);
139
+ userEvent.clear(otherInput);
132
140
  userEvent.type(otherInput, value);
133
141
  };
134
142
 
135
143
  export const typeOtherTextArea = async (value: string): Promise<void> => {
136
144
  const openMenu = await findOpenMenu();
137
145
  const otherTextArea = await findQuick({ classes: ".subComponent", child: { tagName: "textarea" } }, openMenu);
146
+ userEvent.clear(otherTextArea);
138
147
  userEvent.type(otherTextArea, value);
139
148
  };
140
149