Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Update the test

Andrey Okonetchnikov4bb954a15fd8
diff --git a/app/designer/features/props-panel/use-props-logic.test.ts b/app/designer/features/props-panel/use-props-logic.test.ts
index d48dd9c455..e82cb97d30 100644
--- a/app/designer/features/props-panel/use-props-logic.test.ts
+++ b/app/designer/features/props-panel/use-props-logic.test.ts
@@ -1,5 +1,6 @@
import { renderHook, act } from "@testing-library/react-hooks";
import { components, UserProp } from "@webstudio-is/sdk";
+import { nanoid } from "nanoid";
import { SelectedInstanceData } from "~/shared/canvas-components";
import { usePropsLogic } from "./use-props-logic";
@@ -8,15 +9,15 @@ const getSelectedInstanceData = (
props: UserProp[]
): SelectedInstanceData => {
return {
- id: "2",
+ id: nanoid(8),
component: componentName,
cssRules: [],
browserStyle: {},
props: {
- id: "1",
+ id: nanoid(8),
props,
- instanceId: "2",
- treeId: "1",
+ instanceId: nanoid(8),
+ treeId: nanoid(8),
},
};
};
@@ -46,16 +47,14 @@ describe("usePropsLogic", () => {
);
const { result: res2 } = renderHook(() =>
usePropsLogic({
- selectedInstanceData: getSelectedInstanceData("Button", [
- { id: "1", prop: "type", value: "button" },
- ]),
+ selectedInstanceData: getSelectedInstanceData("Button", []),
publish: jest.fn(),
})
);
expect(res1.current.userProps[0]).toBeUndefined();
expect(res2.current.userProps[0]).toMatchObject({
prop: "type",
- value: "button",
+ value: "submit",
});
});