Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zaguiini committed Sep 10, 2024
1 parent 955990c commit b4100c0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/e2e/specs/editor/various/block-bindings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,39 @@ test.describe( 'Block bindings', () => {
).toHaveText( 'fallback value' );
} );

test( 'should prioritize the placeholder attribute over the placeholder generated by the bindings API', async ( {
editor,
} ) => {
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
placeholder: 'My custom placeholder',
content: 'paragraph default content',
metadata: {
bindings: {
content: {
source: 'core/post-meta',
args: { key: 'empty_field' },
},
},
},
},
} );

const paragraphBlock = editor.canvas.getByRole( 'document', {
// Aria-label is changed for empty paragraphs.
name: 'My custom placeholder',
} );

await expect( paragraphBlock ).toBeEmpty();

const placeholder = paragraphBlock.locator( 'span' );
await expect( placeholder ).toHaveAttribute(
'data-rich-text-placeholder',
'My custom placeholder'
);
} );

test( 'should show the prompt placeholder in field with empty value', async ( {
editor,
} ) => {
Expand Down

0 comments on commit b4100c0

Please sign in to comment.