Quality: Replace wpKebabCase function with kebabCase function from components package - #57038
Merged
Merged
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
|
jffng
approved these changes
Dec 14, 2023
jffng
left a comment
Contributor
There was a problem hiding this comment.
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
artemiomorales
pushed a commit
that referenced
this pull request
Jan 4, 2024
…mponents package (#57038)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-editorpackage. In #56758, this function was moved to the@wordpress/componentspackage 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