Skip to content

Commit

Permalink
Update BlockEditorProvider tests (WordPress#51497)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored and sethrubenstein committed Jul 13, 2023
1 parent dc4aecc commit 78b4259
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ describe( 'BlockEditorProvider', () => {
beforeEach( () => {
registry = undefined;
} );
it( 'should strip experimental settings', async () => {
it( 'should not allow updating experimental settings', async () => {
render(
<BlockEditorProvider
settings={ {
inserterMediaCategories: true,
blockInspectorAnimation: true,
} }
>
<HasEditorSetting setRegistry={ setRegistry } />
</BlockEditorProvider>
);
const settings = registry.select( blockEditorStore ).getSettings();
expect( settings ).not.toHaveProperty( 'inserterMediaCategories' );
// `blockInspectorAnimation` setting is one of the block editor's
// default settings, so it has a value. We're testing that its
// value was not updated.
expect( settings.blockInspectorAnimation ).not.toBe( true );
} );
it( 'should preserve stable settings', async () => {
render(
Expand All @@ -65,18 +68,18 @@ describe( 'ExperimentalBlockEditorProvider', () => {
beforeEach( () => {
registry = undefined;
} );
it( 'should preserve experimental settings', async () => {
it( 'should allow updating/adding experimental settings', async () => {
render(
<ExperimentalBlockEditorProvider
settings={ {
inserterMediaCategories: true,
blockInspectorAnimation: true,
} }
>
<HasEditorSetting setRegistry={ setRegistry } />
</ExperimentalBlockEditorProvider>
);
const settings = registry.select( blockEditorStore ).getSettings();
expect( settings ).toHaveProperty( 'inserterMediaCategories' );
expect( settings.blockInspectorAnimation ).toBe( true );
} );
it( 'should preserve stable settings', async () => {
render(
Expand Down

0 comments on commit 78b4259

Please sign in to comment.