Skip to content

Commit

Permalink
Blocks: Remove client-side polyfill for 'selectors' (WordPress#60846)
Browse files Browse the repository at this point in the history
* Blocks: Remove client-side polyfill for 'selectors'
* Remove polyfill's unit test

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
  • Loading branch information
3 people authored Apr 18, 2024
1 parent 8029450 commit 62198d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
37 changes: 0 additions & 37 deletions packages/blocks/src/api/test/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,43 +398,6 @@ describe( 'blocks', () => {
} );
} );

// This can be removed once polyfill adding selectors has been removed.
it( 'should apply selectors on the client when not set on the server', () => {
const blockName = 'core/test-block-with-selectors';
unstable__bootstrapServerSideBlockDefinitions( {
[ blockName ]: {
category: 'widgets',
},
} );
unstable__bootstrapServerSideBlockDefinitions( {
[ blockName ]: {
selectors: { root: '.wp-block-custom-selector' },
category: 'ignored',
},
} );

const blockType = {
title: 'block title',
};
registerBlockType( blockName, blockType );
expect( getBlockType( blockName ) ).toEqual( {
name: blockName,
save: expect.any( Function ),
title: 'block title',
category: 'widgets',
icon: { src: BLOCK_ICON_DEFAULT },
attributes: {},
providesContext: {},
usesContext: [],
keywords: [],
selectors: { root: '.wp-block-custom-selector' },
supports: {},
styles: [],
variations: [],
blockHooks: {},
} );
} );

// This test can be removed once the polyfill for blockHooks gets removed.
it( 'should polyfill blockHooks using metadata on the client when not set on the server', () => {
const blockName = 'tests/hooked-block';
Expand Down
13 changes: 0 additions & 13 deletions packages/blocks/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,6 @@ function bootstrappedBlockTypes( state = {}, action ) {
// Don't overwrite if already set. It covers the case when metadata
// was initialized from the server.
if ( serverDefinition ) {
// The `selectors` prop is not yet included in the server provided
// definitions and needs to be polyfilled. This can be removed when the
// minimum supported WordPress is >= 6.3.
if (
serverDefinition.selectors === undefined &&
blockType.selectors
) {
newDefinition = {
...serverDefinition,
selectors: blockType.selectors,
};
}

// The `blockHooks` prop is not yet included in the server provided
// definitions and needs to be polyfilled. This can be removed when the
// minimum supported WordPress is >= 6.4.
Expand Down

0 comments on commit 62198d2

Please sign in to comment.