cypress-wp-utils
cypress-wp-utils copied to clipboard
insertBlock Command doesn't work with block variations that have multiple backslashes
Describe the bug
When trying to use insertBlock to insert a block variation with multiple backslashes (i.e. core/query/10up/content-grid, the block cannot be found in the inserter, as the first backslash is being converted to a dash (-) when generating the search selector, making the selector fail.
Steps to Reproduce
- Create a block variation (sample registration code added below) of the Query block using a name like
10up/post-grid - Attempt to insert the newly created block in a test
- Confirm that
cy.insertBlock('core/query/10up/post-grid')generates an invalid selector
Screenshots, screen recording, code snippet
Block Variation Registration example
const VARIATION_NAME = '10up/content-grid';
registerBlockVariation('core/query', {
name: VARIATION_NAME,
title: 'Content River',
description: 'A grid of content that can be manually curated',
isActive: ({ namespace }) => namespace === VARIATION_NAME,
attributes: {
namespace: VARIATION_NAME,
query: {
inherit: true,
},
},
scope: ['inserter'],
innerBlocks: [['10up/post-picker-group', {}, []]],
});
Environment information
No response
WordPress information
I'm using a completely fresh install of WordPress 6.3.2 using wp-env
Code of Conduct
- [X] I agree to follow this project's Code of Conduct