-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Quality: Replace wpKebabCase function with kebabCase function from components package #57038
Conversation
Size Change: -30 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in c5fd5ab. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7203734147
|
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.
Thanks @t-hamano! I tested with the following fonts (which had previously caused issues to inconsistent camel casing), and everything is still working as expected:
- B612
- B612 Mono
- Rock 3D
- Press Start 2P
- Libre Barcode 182 Text
- Libre Barcode 39 Text
…mponents package (#57038)
What?
This PR replaces the
wpKebabCase()
function that was used to generate the slug for a font family with thekebabCase()
function, which is a private API of the component package.Why?
The
kebabCase()
function, which is equivalent to WP Core's _wp_to_kebab_case(), originally existed in the@wordpress/block-editor
package. In #56758, this function was moved to the@wordpress/components
package to make it available from various packages.On the other hand, there is a unique
wpKebabCase()
function that kebabcases the slug of a font when it is uploaded. These two functions have almost the same logic, so we should be able to replace them with thekebabCase()
function.How?
I replaced the functions and removed the unit tests that were no longer needed as a result.
Testing Instructions
Screenshots or screencast
8bb56aecc21bba665aaa4bac183d29b3.mp4