-
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
Add tests for Editable.adaptFormatter() #3894
Conversation
I have one concern here. This test covers private function from the component. There was usually a rule to test only public API in the previous projects, I worked with. Do you think we should keep the same rule in Gutenberg? We can always move that method to the file with utilities when we fill that it deserves its own tests. |
If we are fine with testing private methods, then it's good to go 👍 |
One option is if these private methods are used somewhere in a public facing code we can get coverage that way. For now going to leave the PR open. |
blocks/editable/test/index.js
Outdated
test( 'should return an object on inline: span, and a styles property matching the style object provided', () => { | ||
expect( wrapper.instance().adaptFormatter( options ) ).toEqual( { | ||
inline: 'span', | ||
styles: { ...options.style }, |
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 can also simply styles: options.style,
. No need to clone it.
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.
Sometimes I do silly things 🙃
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.
Let's merge it, we can change our approach about testing private methods later.
ebe5f53
to
2f27d54
Compare
Add tests for Editable.adaptFormatter()