Skip to content

Commit

Permalink
Fix reusable blocks test
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 29, 2020
1 parent d989f1d commit d3ad654
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 193 deletions.
13 changes: 6 additions & 7 deletions packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,12 @@ export default function ReusableBlockEdit( {
</BlockControls>

<div className="block-library-block__reusable-block-container">
{ isSelected ||
( hasInnerBlockSelected && (
<ReusableBlockEditPanel
title={ title }
onChange={ setTitle }
/>
) ) }
{ ( isSelected || hasInnerBlockSelected ) && (
<ReusableBlockEditPanel
title={ title }
onChange={ setTitle }
/>
) }

{ <div { ...innerBlocksProps } /> }
</div>
Expand Down
12 changes: 6 additions & 6 deletions packages/e2e-test-utils/src/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export async function searchForReusableBlock( searchTerm ) {
*/
export async function insertBlock( searchTerm ) {
await searchForBlock( searchTerm );
const insertButton = (
await page.$x( `//button//span[contains(text(), '${ searchTerm }')]` )
)[ 0 ];
const insertButton = await page.waitForXPath(
`//button//span[contains(text(), '${ searchTerm }')]`
);
await insertButton.click();
// We should wait until the inserter closes and the focus moves to the content.
await waitForInserterCloseAndContentFocus();
Expand Down Expand Up @@ -164,9 +164,9 @@ export async function insertPattern( searchTerm ) {
*/
export async function insertReusableBlock( searchTerm ) {
await searchForReusableBlock( searchTerm );
const insertButton = (
await page.$x( `//button//span[contains(text(), '${ searchTerm }')]` )
)[ 0 ];
const insertButton = await page.waitForXPath(
`//button//span[contains(text(), '${ searchTerm }')]`
);
await insertButton.click();
// We should wait until the inserter closes and the focus moves to the content.
await waitForInserterCloseAndContentFocus();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Reusable blocks multi-selection reusable block can be converted back to regular blocks 1`] = `
exports[`Reusable blocks can be created from multiselection and converted back to regular blocks 1`] = `
"<!-- wp:paragraph -->
<p>Hello there!</p>
<!-- /wp:paragraph -->
Expand Down
Loading

0 comments on commit d3ad654

Please sign in to comment.