feat(pages): add reusable page block editor and renderer baseline
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
createCustomerInputSchema,
|
||||
createNavigationMenuInputSchema,
|
||||
createPageInputSchema,
|
||||
parsePageBlocks,
|
||||
serializePageBlocks,
|
||||
updateCommissionStatusInputSchema,
|
||||
updateNavigationItemInputSchema,
|
||||
} from "./index"
|
||||
@@ -64,4 +66,23 @@ describe("domain schemas", () => {
|
||||
expect(menu.success).toBe(true)
|
||||
expect(navUpdate.success).toBe(false)
|
||||
})
|
||||
|
||||
it("parses and serializes page blocks with legacy fallback", () => {
|
||||
const legacy = parsePageBlocks("Legacy body")
|
||||
expect(legacy[0]?.type).toBe("rich_text")
|
||||
|
||||
const serialized = serializePageBlocks([
|
||||
{
|
||||
id: "hero-1",
|
||||
type: "hero",
|
||||
heading: "Hello",
|
||||
subheading: null,
|
||||
ctaLabel: null,
|
||||
ctaHref: null,
|
||||
},
|
||||
])
|
||||
|
||||
const parsed = parsePageBlocks(serialized)
|
||||
expect(parsed[0]?.type).toBe("hero")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user