Files
webstudio/app/shared/tree-utils/delete-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

56 lines
1.1 KiB
TypeScript

import { type Instance } from "@webstudio-is/sdk";
import { deleteInstanceMutable } from "./delete-instance";
describe("Delete instance", () => {
test("div 1 > div 2 > [div 3]", () => {
const instance: Instance = {
component: "Box",
id: "1",
cssRules: [],
children: [
{
component: "Box",
id: "2",
cssRules: [],
children: [
{
component: "Box",
id: "3",
cssRules: [],
children: [],
},
],
},
],
};
deleteInstanceMutable(instance, "3");
expect(instance).toMatchSnapshot();
});
test("div 1 > div 2, [div 3]", () => {
const instance: Instance = {
component: "Box",
id: "1",
cssRules: [],
children: [
{
component: "Box",
id: "2",
cssRules: [],
children: [],
},
{
component: "Box",
id: "3",
cssRules: [],
children: [],
},
],
};
deleteInstanceMutable(instance, "3");
expect(instance).toMatchSnapshot();
});
});