Merge layout compatibility fix into dnd kit
This commit is contained in:
2 files changed
+15
-3
No files matched your search
@@ -44,8 +44,16 @@ describe("section behavior validation", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(["category", "dynamic"])("rejects the legacy %s kind", (kind) => {
|
it("normalizes the legacy dynamic kind to a container", () => {
|
||||||
expect(() => sectionSchema.parse({ id: "legacy", kind, layouts: [] })).toThrow();
|
expect(sectionSchema.parse({ id: "legacy", kind: "dynamic", layouts: [] })).toMatchObject({
|
||||||
|
id: "legacy",
|
||||||
|
kind: "container",
|
||||||
|
layouts: [],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects the legacy category kind", () => {
|
||||||
|
expect(() => sectionSchema.parse({ id: "legacy", kind: "category", layouts: [] })).toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@@ -93,4 +93,8 @@ const containerSectionSchema = z.object({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema]);
|
const legacyDynamicSectionSchema = containerSectionSchema
|
||||||
|
.extend({ kind: z.literal("dynamic") })
|
||||||
|
.transform((section) => ({ ...section, kind: "container" as const }));
|
||||||
|
|
||||||
|
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema, legacyDynamicSectionSchema]);
|
||||||
Reference in new issue
Block a user