Skip to content

Commit

Permalink
Add a new test covering the extensibility inside inspector controls
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Dec 3, 2024
1 parent f3fa0d5 commit 02805fc
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/e2e/specs/editor/various/block-bindings/post-meta.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,47 @@ test.describe( 'Post Meta source', () => {
previewPage.locator( '#connected-paragraph' )
).toHaveText( 'new value' );
} );

test( 'should be possible to edit the value of the connected custom fields in the inspector control registered by the plugin', async ( {
editor,
page,
} ) => {
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
anchor: 'connected-paragraph',
content: 'fallback content',
metadata: {
bindings: {
content: {
source: 'core/post-meta',
args: {
key: 'movie_field',
},
},
},
},
},
} );
const contentInput = page.getByRole( 'textbox', {
name: 'Content',
} );
await expect( contentInput ).toHaveValue(
'Movie field default value'
);
await contentInput.fill( 'new value' );
// Check that the paragraph content attribute didn't change.
const [ paragraphBlockObject ] = await editor.getBlocks();
expect( paragraphBlockObject.attributes.content ).toBe(
'fallback content'
);
// Check the value of the custom field is being updated by visiting the frontend.
const previewPage = await editor.openPreviewPage();
await expect(
previewPage.locator( '#connected-paragraph' )
).toHaveText( 'new value' );
} );

test( 'should be possible to connect movie fields through the attributes panel', async ( {
editor,
page,
Expand Down

0 comments on commit 02805fc

Please sign in to comment.