Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e test to ensure block bindings work well with symbols and numbers #62410

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions test/e2e/specs/editor/various/block-bindings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,41 @@ test.describe( 'Block bindings', () => {
).toHaveText( 'new value' );
} );

// Related issue: https://github.com/WordPress/gutenberg/issues/62347
test( 'should be possible to use symbols and numbers as the custom field value', async ( {
editor,
} ) => {
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
anchor: 'paragraph-binding',
content: 'paragraph default content',
metadata: {
bindings: {
content: {
source: 'core/post-meta',
args: { key: 'text_custom_field' },
},
},
},
},
} );
const paragraphBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Paragraph',
} );

await expect( paragraphBlock ).toHaveAttribute(
'contenteditable',
'true'
);
await paragraphBlock.fill( '$10.00' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering how it gets saved, but it looks like autosave triggers when opening a preview 👍🏻

// Check the value of the custom field is being updated by visiting the frontend.
const previewPage = await editor.openPreviewPage();
await expect(
previewPage.locator( '#paragraph-binding' )
).toHaveText( '$10.00' );
} );

test( 'should be possible to edit the value of the url custom field from the button', async ( {
editor,
page,
Expand Down
Loading