Skip to content
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

insertBlock Command doesn't work with block variations that have multiple backslashes #112

Open
1 task done
roseg43 opened this issue Oct 24, 2023 · 0 comments
Open
1 task done
Labels
type:bug Something isn't working.

Comments

@roseg43
Copy link

roseg43 commented Oct 24, 2023

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

  1. Create a block variation (sample registration code added below) of the Query block using a name like 10up/post-grid
  2. Attempt to insert the newly created block in a test
  3. 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

  • I agree to follow this project's Code of Conduct
@roseg43 roseg43 added the type:bug Something isn't working. label Oct 24, 2023
@roseg43 roseg43 changed the title insertBlock Command doesn't work with block variations insertBlock Command doesn't work with block variations that have multiple backslashes Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working.
Projects
Status: Incoming
Development

No branches or pull requests

1 participant