chore: bump @testing-library/react 12.1.5 -> 16.0.0 (#8322)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { render } from "./test-utils";
|
||||
import { act, render } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { reseed } from "../random";
|
||||
import {
|
||||
@@ -86,31 +87,35 @@ const populateElements = (
|
||||
);
|
||||
|
||||
// initialize `boundElements` on containers, if applicable
|
||||
h.elements = newElements.map((element, index, elements) => {
|
||||
const nextElement = elements[index + 1];
|
||||
if (
|
||||
nextElement &&
|
||||
"containerId" in nextElement &&
|
||||
element.id === nextElement.containerId
|
||||
) {
|
||||
return {
|
||||
...element,
|
||||
boundElements: [{ type: "text", id: nextElement.id }],
|
||||
};
|
||||
}
|
||||
return element;
|
||||
});
|
||||
API.setElements(
|
||||
newElements.map((element, index, elements) => {
|
||||
const nextElement = elements[index + 1];
|
||||
if (
|
||||
nextElement &&
|
||||
"containerId" in nextElement &&
|
||||
element.id === nextElement.containerId
|
||||
) {
|
||||
return {
|
||||
...element,
|
||||
boundElements: [{ type: "text", id: nextElement.id }],
|
||||
};
|
||||
}
|
||||
return element;
|
||||
}),
|
||||
);
|
||||
|
||||
h.setState({
|
||||
...selectGroupsForSelectedElements(
|
||||
{ ...h.state, ...appState, selectedElementIds },
|
||||
h.elements,
|
||||
h.state,
|
||||
null,
|
||||
),
|
||||
...appState,
|
||||
selectedElementIds,
|
||||
} as AppState);
|
||||
act(() => {
|
||||
h.setState({
|
||||
...selectGroupsForSelectedElements(
|
||||
{ ...h.state, ...appState, selectedElementIds },
|
||||
h.elements,
|
||||
h.state,
|
||||
null,
|
||||
),
|
||||
...appState,
|
||||
selectedElementIds,
|
||||
} as AppState);
|
||||
});
|
||||
|
||||
return selectedElementIds;
|
||||
};
|
||||
@@ -140,7 +145,7 @@ const assertZindex = ({
|
||||
}) => {
|
||||
const selectedElementIds = populateElements(elements, appState);
|
||||
operations.forEach(([action, expected]) => {
|
||||
h.app.actionManager.executeAction(action);
|
||||
API.executeAction(action);
|
||||
expect(h.elements.map((element) => element.id)).toEqual(expected);
|
||||
expect(h.state.selectedElementIds).toEqual(selectedElementIds);
|
||||
});
|
||||
@@ -894,7 +899,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "A", isSelected: true },
|
||||
{ id: "B", isSelected: true },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements).toMatchObject([
|
||||
{ id: "A" },
|
||||
{ id: "A_copy" },
|
||||
@@ -906,7 +911,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "A", groupIds: ["g1"], isSelected: true },
|
||||
{ id: "B", groupIds: ["g1"], isSelected: true },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements).toMatchObject([
|
||||
{ id: "A" },
|
||||
{ id: "B" },
|
||||
@@ -927,7 +932,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "B", groupIds: ["g1"], isSelected: true },
|
||||
{ id: "C" },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements).toMatchObject([
|
||||
{ id: "A" },
|
||||
{ id: "B" },
|
||||
@@ -949,7 +954,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "B", groupIds: ["g1"], isSelected: true },
|
||||
{ id: "C", isSelected: true },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -965,7 +970,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "C", groupIds: ["g2"], isSelected: true },
|
||||
{ id: "D", groupIds: ["g2"], isSelected: true },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -987,7 +992,7 @@ describe("z-index manipulation", () => {
|
||||
selectedGroupIds: { g1: true },
|
||||
},
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -1007,7 +1012,7 @@ describe("z-index manipulation", () => {
|
||||
selectedGroupIds: { g2: true },
|
||||
},
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -1030,7 +1035,7 @@ describe("z-index manipulation", () => {
|
||||
selectedGroupIds: { g2: true, g4: true },
|
||||
},
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -1054,7 +1059,7 @@ describe("z-index manipulation", () => {
|
||||
],
|
||||
{ editingGroupId: "g1" },
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"A_copy",
|
||||
@@ -1070,7 +1075,7 @@ describe("z-index manipulation", () => {
|
||||
],
|
||||
{ editingGroupId: "g1" },
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
@@ -1086,7 +1091,7 @@ describe("z-index manipulation", () => {
|
||||
],
|
||||
{ editingGroupId: "g1" },
|
||||
);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"A_copy",
|
||||
@@ -1102,7 +1107,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "B" },
|
||||
{ id: "C", groupIds: ["g1"], isSelected: true },
|
||||
]);
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"C",
|
||||
@@ -1120,7 +1125,7 @@ describe("z-index manipulation", () => {
|
||||
{ id: "D" },
|
||||
]);
|
||||
expect(h.state.selectedGroupIds).toEqual({ g1: true });
|
||||
h.app.actionManager.executeAction(actionDuplicateSelection);
|
||||
API.executeAction(actionDuplicateSelection);
|
||||
expect(h.elements.map((element) => element.id)).toEqual([
|
||||
"A",
|
||||
"B",
|
||||
|
||||
Reference in New Issue
Block a user