Skip to content
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

Closed
10 tasks done
gziolo opened this issue Oct 26, 2018 · 9 comments
Closed
10 tasks done

Tests: Add missing tests for Format API code #11110

gziolo opened this issue Oct 26, 2018 · 9 comments
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Comments

@gziolo
Copy link
Member

gziolo commented Oct 26, 2018

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

RichText actions

  • addFormatTypes
  • removeFormatTypes

RichText selectors

  • getFormatTypes
  • getFormatType
@gziolo gziolo added Good First Issue An issue that's suitable for someone looking to contribute for the first time [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. labels Oct 26, 2018
@Pixelrobin
Copy link
Contributor

I'll try to tackle this one!

@Pixelrobin
Copy link
Contributor

I assume you mean getFormatType and getFormatTypes in the Format API section? They're also listed in the RichText selectors section.

@gziolo
Copy link
Member Author

gziolo commented Oct 30, 2018

Yes, you are correct. Description updated.

@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Nov 2, 2018
@junixdev
Copy link

junixdev commented Nov 5, 2018

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 wp.richText.getFormatType in the console.

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?

@gziolo
Copy link
Member Author

gziolo commented Nov 5, 2018

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.

@desrosj
Copy link
Contributor

desrosj commented Nov 5, 2018

@Pixelrobin Are you still able to work on this?

@Pixelrobin
Copy link
Contributor

@desrosj Yes, sorry, I got caught up in other things for a bit.

@Pixelrobin
Copy link
Contributor

Opened PR #11562. Sorry for the wait, and the merge conflicts. It looks like you could just ignore my version of register-format-type in the tests?

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!

@gziolo
Copy link
Member Author

gziolo commented Nov 7, 2018

@Pixelrobin great work, I will take a closer look later today 👍

Sorry for the wait, and the merge conflicts. It looks like you could just ignore my version of register-format-type in the tests?

No worries, I will see if we can cherry-pick some of your tests from this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

No branches or pull requests

5 participants