-
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
Navigation Block: Add test coverage to check that post content is not removed #60189
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thank you, @ockham!
…e nav menu (WordPress#60189) Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
…e nav menu (WordPress#60189) Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Can/should this test be backported to core? |
My understanding is that this test provides coverage for the Navigation block. The block is maintained in the Gutenberg repo and therefore tests reside in the Gutenberg repo. At least that's what I picked up from Riad as the state of things during the Editor Tech lead role for WP 6.5. |
What?
Add a unit test to cover #59991 (fixed in #60071). The issue was that if a navigation menu was renamed (but not changed otherwise), its content was accidentally deleted.
The reason for this was related to the
stdClass
object that's used to communicate required changes towp_update_post
: If itspost_content
field was not set (indicating no changes were to be made),block_core_navigation_update_ignore_hooked_blocks_meta
would accidentally set that field to an empty string (meaning it would be replaced by that) -- thus causing loss of data.Why?
To prevent against regressions.
How?
Verify that if the
stdClass
object'spost_content
is unset before runningblock_core_navigation_update_ignore_hooked_blocks_meta
, it also is afterwards.Testing Instructions
Verify that tests pass.
To verify that the test covers the issue, revert 7b6ac8d (i.e. #60071), rebuild Gutenberg, and re-run the tests. They should now fail.