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

Patterns: stop endless snackbars appearing #52012

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/create-reusable-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const createReusableBlock = async ( content, title ) => {

// Wait for creation to finish
await page.waitForXPath(
'//*[contains(@class, "components-snackbar")]/*[text()="Synced Pattern created."]'
'//*[contains(@class, "components-snackbar")]/*[contains(text(),"Pattern created:")]'
);

// Check that we have a reusable block on the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe( 'Reusable blocks', () => {

// Wait for creation to finish.
await page.waitForXPath(
'//*[contains(@class, "components-snackbar")]/*[text()="Synced Pattern created."]'
'//*[contains(@class, "components-snackbar")]/*[contains(text(),"Pattern created:")]'
);

await clearAllBlocks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@wordpress/components';
import { symbol } from '@wordpress/icons';
import { useDispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { store as coreStore } from '@wordpress/core-data';

Expand Down Expand Up @@ -98,15 +98,25 @@ export default function ReusableBlockConvertButton( {
);
createSuccessNotice(
syncType === 'fully'
? __( 'Synced Pattern created.' )
: __( 'Unsynced Pattern created.' ),
? sprintf(
// translators: %s: the name the user has given to the pattern.
__( 'Synced Pattern created: %s' ),
reusableBlockTitle
)
: sprintf(
// translators: %s: the name the user has given to the pattern.
__( 'Unsynced Pattern created: %s' ),
reusableBlockTitle
),
{
type: 'snackbar',
id: 'convert-to-reusable-block-success',
}
);
} catch ( error ) {
createErrorNotice( error.message, {
type: 'snackbar',
id: 'convert-to-reusable-block-error',
} );
}
},
Expand Down
Loading