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

Improve text and design of the block removal warnings #56869

Merged
merged 4 commits into from
Dec 8, 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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Button,
__experimentalHStack as HStack,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, _n } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -48,22 +48,15 @@ export function BlockRemovalWarningModal( { rules } ) {

return (
<Modal
title={ __( 'Are you sure?' ) }
title={ __( 'Be careful!' ) }
onRequestClose={ clearBlockRemovalPrompt }
>
{ blockNamesForPrompt.length === 1 ? (
<p>{ rules[ blockNamesForPrompt[ 0 ] ] }</p>
) : (
<ul style={ { listStyleType: 'disc', paddingLeft: '1rem' } }>
{ blockNamesForPrompt.map( ( name ) => (
<li key={ name }>{ rules[ name ] }</li>
) ) }
</ul>
) }
<p>
{ blockNamesForPrompt.length > 1
? __( 'Removing these blocks is not advised.' )
: __( 'Removing this block is not advised.' ) }
{ _n(
'Post or page content will not be displayed if you delete this block.',
'Post or page content will not be displayed if you delete these blocks.',
blockNamesForPrompt.length
) }
</p>
<HStack justify="right">
<Button variant="tertiary" onClick={ clearBlockRemovalPrompt }>
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/specs/site-editor/block-removal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ test.describe( 'Site editor block removal prompt', () => {

// Expect the block removal prompt to have appeared
await expect(
page.getByText( 'Query Loop displays a list of posts or pages.' )
page.getByText(
'Post or page content will not be displayed if you delete these blocks.'
)
).toBeVisible();
} );

Expand All @@ -57,7 +59,7 @@ test.describe( 'Site editor block removal prompt', () => {
// Expect the block removal prompt to have appeared
await expect(
page.getByText(
'Post Template displays each post or page in a Query Loop.'
'Post or page content will not be displayed if you delete this block.'
)
).toBeVisible();
} );
Expand Down
Loading