-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: Add missing tests for Format API code #11110
Comments
I'll try to tackle this one! |
I assume you mean |
Yes, you are correct. Description updated. |
I was able to successfully register a custom format in the editor, and I can confirm that it was registered successfully by running the code The formatting also works with the keyboard shortcut key I set it to, but unfortunately the button I've set for the formatting is not showing. Can you please provide like a brief process on how to register a format type and have it displayed as one of the formatting buttons on blocks? |
We are working on documentation in #11105. Can you open a separate issue for your use case with the code snippet included so we could help you? This issue is meant to track progress on unit tests. |
@Pixelrobin Are you still able to work on this? |
@desrosj Yes, sorry, I got caught up in other things for a bit. |
Opened PR #11562. Sorry for the wait, and the merge conflicts. It looks like you could just ignore my version of This was my first Gutenberg PR and first time using Jest, so I learned a lot 😄, thanks for that opportunity. I hope it's good to go! |
@Pixelrobin great work, I will take a closer look later today 👍
No worries, I will see if we can cherry-pick some of your tests from this file. |
When working on #10209 we added a few unit tests. However, we could use them more to have much better coverage which should help us avoid regressions in the future.
We miss tests for the following:
Format API
registerFormatType
(similar to https://github.com/WordPress/gutenberg/blob/master/packages/blocks/src/api/test/registration.js#L52)unregisterFormatType
(similar to https://github.com/WordPress/gutenberg/blob/master/packages/blocks/src/api/test/registration.js#L337)getFormatType
(similar to https://github.com/WordPress/gutenberg/blob/master/packages/blocks/src/api/test/registration.js#L414)getFormatTypes
(similar to https://github.com/WordPress/gutenberg/blob/master/packages/blocks/src/api/test/registration.js#L444)insertObject
toggleFormat
RichText actions
addFormatTypes
removeFormatTypes
RichText selectors
getFormatTypes
getFormatType
The text was updated successfully, but these errors were encountered: