-
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
Fix losing overrides after detaching patterns #58164
Conversation
await editor.selectBlocks( | ||
editor.canvas.getByRole( 'document', { name: 'Block: Pattern' } ) | ||
); | ||
await editor.showBlockToolbar(); |
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.
This should not be necessary; the clickBlockOptionsMenuItem
will handle that.
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.
Yeah, I'm just including it for clarity. It's clearer for me this way that clickBlockOptionsMenuItem
is interacting with the block toolbar, but not some other UI on the page. But yeah, I agree it's unnecessary and clickBlockOptionsMenuItem
should be clear enough 😅.
Size Change: +36 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@@ -252,4 +252,49 @@ test.describe( 'Synced pattern', () => { | |||
}, | |||
] ); | |||
} ); | |||
|
|||
// Check for regressions of https://github.com/WordPress/gutenberg/issues/26421. | |||
test( 'allows conversion back to blocks when the reusable block has unsaved edits', async ( { |
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.
The original test tested when there are unsaved edits to the reusable block entity, which seems to be lost now in this new test, but I think is still a valuable test.
The new test is also valuable, but maybe it's worth also keeping the original and restoring it at some point rather than deleting it (it would have to be changed to use the 'Edit original' button to update the entity).
Given this new test is for overrides, is it worth moving it to the pattern-overrides
file? Suggestion for a new test title:
test( 'allows conversion back to blocks when the reusable block has unsaved edits', async ( { | |
test( 'retains override values when converting a pattern block to regular blocks', async ( { |
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.
Hmm, right! Makes sense!
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.
Updated in fe5aa44.
Flaky tests detected in 7eb5952. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7636517303
|
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 for spotting and solving the issue, this is working nicely, and it's great that tests were added.
What?
Fix #58122. Also migrated a test into Playwright.
Why?
Part of #53705.
How?
It's undecided whether we should keep the blocks'
id
s andbindings
after detaching, but at this stage I think it's easier to remove them all. We can add them back in a follow-up if needed.Testing Instructions
pattern with overrides and add it to a post.
Screenshots or screencast
Kapture.2024-01-24.at.14.44.45.mp4