@linzjs/step-ag-grid 17.4.4 → 17.4.6

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": "17.4.4",
5
+ "version": "17.4.6",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -612,7 +612,7 @@ export const Grid = ({
612
612
  const onRowDragEnd = useCallback(
613
613
  async (event: RowDragEndEvent) => {
614
614
  const clientSideRowModel = event.api.getModel() as IClientSideRowModel;
615
- if (event.node.rowIndex) {
615
+ if (event.node.rowIndex != null) {
616
616
  const lastHighlightedRowNode = clientSideRowModel.getLastHighlightedRowNode();
617
617
  const isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === RowHighlightPosition.Below;
618
618
 
@@ -626,7 +626,7 @@ export const Grid = ({
626
626
  const moved = event.node.data;
627
627
  const target = event.overNode?.data;
628
628
  moved.id != target.id && //moved over a different row
629
- moved.rowIndex != targetIndex && //moved to a different index
629
+ event.node.rowIndex != targetIndex && //moved to a different index
630
630
  params.onRowDragEnd &&
631
631
  (await params.onRowDragEnd(moved, target, targetIndex));
632
632
  }
@@ -1,4 +1,4 @@
1
- import { waitFor, within } from "@testing-library/react";
1
+ import { act, waitFor, within } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
3
  import { isEqual } from "lodash-es";
4
4
 
@@ -21,7 +21,25 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
21
21
  await waitFor(async () => {
22
22
  expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
23
23
  });
24
- return await findQuick<HTMLDivElement>({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
24
+ //if this is not wrapped in an act console errors are logged during testing
25
+ let row!: HTMLDivElement;
26
+ await act(async () => {
27
+ row = await findQuick<HTMLDivElement>(
28
+ { tagName: `.ag-center-cols-container div[row-id='${rowId}']:not(:empty)` },
29
+ within,
30
+ );
31
+ const leftCols = await findQuick<HTMLDivElement>(
32
+ { tagName: `.ag-pinned-left-cols-container div[row-id='${rowId}']` },
33
+ within,
34
+ );
35
+ const rightCols = await findQuick<HTMLDivElement>(
36
+ { tagName: `.ag-pinned-right-cols-container div[row-id='${rowId}']` },
37
+ within,
38
+ );
39
+ const combineChildren = [...leftCols.children, ...row.children, ...rightCols.children];
40
+ row.replaceChildren(...combineChildren);
41
+ });
42
+ return row;
25
43
  };
26
44
 
27
45
  export const queryRow = async (rowId: number | string, within?: HTMLElement): Promise<HTMLDivElement | null> => {