From ed03d97bebab4a17dd542a851d9db30cfb333568 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 3 Jul 2024 02:44:34 +0900 Subject: [PATCH] Fix unit test --- .../src/components/block-switcher/test/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-switcher/test/index.js b/packages/block-editor/src/components/block-switcher/test/index.js index ce900003e7a60..bc1b7d1a4a364 100644 --- a/packages/block-editor/src/components/block-switcher/test/index.js +++ b/packages/block-editor/src/components/block-switcher/test/index.js @@ -134,7 +134,7 @@ describe( 'BlockSwitcher', () => { expect( items[ 1 ] ).toHaveTextContent( headingBlockType.title ); } ); - test( 'should render disabled block switcher when we have a single selected block without styles and we cannot remove it', () => { + test( 'should render accessibly disabled block switcher when we have a single selected block without styles and we cannot remove it', () => { useSelect.mockImplementation( () => ( { blocks: [ headingBlock1 ], icon: copy, @@ -142,11 +142,11 @@ describe( 'BlockSwitcher', () => { canRemove: false, } ) ); render( ); - expect( - screen.getByRole( 'button', { - name: 'Block Name', - } ) - ).toBeDisabled(); + const blockSwitcher = screen.getByRole( 'button', { + name: 'Block Name', + } ); + expect( blockSwitcher ).toBeEnabled(); + expect( blockSwitcher ).toHaveAttribute( 'aria-disabled', 'true' ); } ); test( 'should render message for no available transforms', async () => {