Files
webstudio/app/shared/tree-utils/find-parent-instance.test.ts
T
Oleg Isonen 5116ea4140 predefined breakpoints now loaded from server
in preparation to be loaded form db
2022-04-20 17:34:42 +01:00

32 lines
782 B
TypeScript

import { type Instance } from "@webstudio-is/sdk";
import { findParentInstance } from "./find-parent-instance";
describe("Find parent instance", () => {
test("find", () => {
const rootInstance: Instance = {
component: "Box",
id: "1",
cssRules: [],
children: [
{
component: "Box",
id: "2",
cssRules: [],
children: [
{
component: "Box",
id: "3",
cssRules: [],
children: [],
},
],
},
],
};
expect(findParentInstance(rootInstance, "3")?.id).toBe("2");
expect(findParentInstance(rootInstance, "2")?.id).toBe("1");
expect(findParentInstance(rootInstance, "1")).toBe(undefined);
});
});