mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 21:15:18 +09:00
35 lines
867 B
TypeScript
35 lines
867 B
TypeScript
import { type Instance } from "@webstudio-is/sdk";
|
|
import { type InstanceReparentingSpec } from ".";
|
|
import { reparentInstance } from "./reparent-instance";
|
|
|
|
describe("Reparent instance", () => {
|
|
test(`div 1 > div 2, div 3 => div 1 > div 2 > div 3`, () => {
|
|
const rootInstance: Instance = {
|
|
component: "Box",
|
|
id: "1",
|
|
style: {},
|
|
children: [
|
|
{
|
|
component: "Box",
|
|
id: "2",
|
|
style: {},
|
|
children: [],
|
|
},
|
|
{
|
|
component: "Box",
|
|
id: "3",
|
|
style: {},
|
|
children: [],
|
|
},
|
|
],
|
|
};
|
|
const instanceReparentingSpec: InstanceReparentingSpec = {
|
|
parentId: "2",
|
|
position: "end",
|
|
id: "3",
|
|
};
|
|
const result = reparentInstance(rootInstance, instanceReparentingSpec);
|
|
expect(result).toMatchSnapshot();
|
|
});
|
|
});
|