From 7e095bd91cc72ad7aeda1fa4ee15b6cb3e779879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Thu, 4 Apr 2024 09:32:26 +0200 Subject: [PATCH] fix test case --- .../test/disable-non-page-content-blocks.js | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/packages/editor/src/components/provider/test/disable-non-page-content-blocks.js b/packages/editor/src/components/provider/test/disable-non-page-content-blocks.js index d7c051a0959a37..3da99e6681aa9b 100644 --- a/packages/editor/src/components/provider/test/disable-non-page-content-blocks.js +++ b/packages/editor/src/components/provider/test/disable-non-page-content-blocks.js @@ -40,34 +40,44 @@ describe( 'DisableNonPageContentBlocks', () => { type: 'UNSET_BLOCK_EDITING_MODE', } ) ); - const registry = createRegistry( { - 'core/block-editor': { - reducer: () => {}, - selectors: { - getBlocksByName( state, blockNames ) { - return Object.keys( testBlocks ).filter( ( clientId ) => - blockNames.includes( testBlocks[ clientId ] ) - ); - }, - getBlockParents( state, clientId ) { - return clientId.slice( 0, -1 ).split( '' ); - }, - getBlockName( state, clientId ) { - return testBlocks[ clientId ]; - }, - getBlockOrder( state, rootClientId ) { - return Object.keys( testBlocks ).filter( - ( clientId ) => - clientId.startsWith( rootClientId ) && - clientId !== rootClientId - ); - }, + const registry = createRegistry(); + + registry.registerStore( 'core/block-editor', { + reducer: () => {}, + selectors: { + getBlocksByName( state, blockNames ) { + return Object.keys( testBlocks ).filter( ( clientId ) => + blockNames.includes( testBlocks[ clientId ] ) + ); + }, + getBlockParents( state, clientId ) { + return clientId.slice( 0, -1 ).split( '' ); + }, + getBlockName( state, clientId ) { + return testBlocks[ clientId ]; + }, + getBlockOrder( state, rootClientId ) { + return Object.keys( testBlocks ).filter( + ( clientId ) => + clientId.startsWith( rootClientId ) && + clientId !== rootClientId + ); }, - actions: { - setBlockEditingMode, - unsetBlockEditingMode, + }, + actions: { + setBlockEditingMode, + unsetBlockEditingMode, + }, + } ); + + registry.registerStore( 'core', { + reducer: () => {}, + selectors: { + canUser() { + return true; }, }, + actions: {}, } ); const { unmount } = render(