-
Notifications
You must be signed in to change notification settings - Fork 11
Support definition of public frontend attributes and only serialize those #15
Conversation
@@ -1,13 +1,16 @@ | |||
import { InnerBlocks, useBlockProps } from "@wordpress/block-editor"; | |||
import { registerBlockType as gutenbergRegisterBlockType } from "@wordpress/blocks"; | |||
import { getFrontendAttributes } from "./utils"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put the getFrontendAttributes
in a separate file for no reason other than that it's easier to mock in tests this way.
jest.mock("@wordpress/blocks", () => { | ||
return { | ||
__esModule: true, | ||
getBlockType: () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We mock this function which is being called inside of the getFrontendAttributes()
to give us a our fake attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It even has tests 😱
frontend: true
property
Fixing #13