From c5f56dedf833c6bb0caf1371219d440e82024a3f Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 15 Feb 2024 18:19:21 +0400 Subject: [PATCH] Image: Mark connected controls as 'readyonly' (#59059) * Image: Mark connected controls as 'readyonly' * Update e2e tests Co-authored-by: Mamaduka Co-authored-by: michalczaplinski Co-authored-by: afercia # Conflicts: # test/e2e/specs/editor/various/block-bindings.spec.js --- packages/block-library/src/image/image.js | 4 ++-- test/e2e/specs/editor/various/block-bindings.spec.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index fe160419f9c8bc..62184e6522adb9 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -634,7 +634,7 @@ export default function Image( { label={ __( 'Alternative text' ) } value={ alt || '' } onChange={ updateAlt } - disabled={ lockAltControls } + readOnly={ lockAltControls } help={ lockAltControls ? ( <> @@ -676,7 +676,7 @@ export default function Image( { label={ __( 'Title attribute' ) } value={ title || '' } onChange={ onSetTitle } - disabled={ lockTitleControls } + readOnly={ lockTitleControls } help={ lockTitleControls ? ( <>{ __( 'Connected to a custom field' ) } diff --git a/test/e2e/specs/editor/various/block-bindings.spec.js b/test/e2e/specs/editor/various/block-bindings.spec.js index ccd115e79e8d82..9392058ce54d6a 100644 --- a/test/e2e/specs/editor/various/block-bindings.spec.js +++ b/test/e2e/specs/editor/various/block-bindings.spec.js @@ -565,7 +565,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const altValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) @@ -644,7 +644,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Title attribute' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const titleValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Title attribute' ) @@ -700,7 +700,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const altValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) @@ -1108,7 +1108,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const altValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) @@ -1184,7 +1184,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Title attribute' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const titleValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Title attribute' ) @@ -1254,7 +1254,7 @@ test.describe( 'Block bindings', () => { page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' ) - ).toBeDisabled(); + ).toHaveAttribute( 'readonly' ); const altValue = await page .getByRole( 'tabpanel', { name: 'Settings' } ) .getByLabel( 'Alternative text' )