-
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
Fix block rename control shown in "Advanced" for unsupported blocks #55995
Conversation
Size Change: -5 B (0%) Total Size: 1.63 MB
ℹ️ View Unchanged
|
test( 'does not allow renaming of blocks that do not support the feature', async ( { | ||
editor, | ||
page, | ||
pageUtils, | ||
} ) => { | ||
// Only Group supports renaming. | ||
await editor.insertBlock( { | ||
name: 'core/paragraph', | ||
attributes: { content: 'First Paragraph' }, | ||
} ); | ||
|
||
// Multiselect via keyboard. | ||
await pageUtils.pressKeys( 'primary+a' ); | ||
|
||
// Expect the Rename control not to exist at all. | ||
await expect( | ||
page.getByRole( 'menuitem', { | ||
name: 'Rename', | ||
includeHidden: true, // the option is hidden behind modal | ||
} ) | ||
).toBeHidden(); |
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.
Which part of the UI does this test? It's not clear from the test.
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 describe block provides the context. However the test itself could be made more focused by scoping the selectors to the relevant portion of the UI rather than the broad "rename" option.
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.
I'm assuming this tests menu item in the block toolbar options dropdown. Then, this expectation will never fail since the test doesn't open the dropdown, so the element === hidden
assertion is always true.
That was the reason for my question because it wasn't clear where the "Rename" menu item should be located from the test.
Screenshot
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.
I've updated the scoping on the test. Feel free to merge if it looks good.
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, Dave!
The fix looks good and works as expected in my tests. I just have one question related to the new e2e tests.
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.
LGTM
What will happen to these tests in trunk? Will they just be lost?
Nothing should happen to them. They stay as is. This gets merged directly into Then I have a separate task to effectively backport some stuff from here to merge it into Gutenberg |
I'm just working through the PRs that need cherry-picking for the next 6.4 point release and wanted to confirm that this will be included in the next package update in Core. |
@t-hamano Can I confirm that if you check out the |
What?
Ensures that block rename control is not shown for blocks that do not support the feature
Fixes #55953
Why?
Because only Group supports in 6.4. In
trunk
this is enabled for all blocks.How?
Gates the feature by the correct supports.
Testing Instructions
Advanced
panelTesting Instructions for Keyboard
Screenshots or screencast