Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Aug 15, 2024
1 parent 1dfcd70 commit 4c52e15
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/e2e/specs/editor/blocks/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,36 @@ test.describe( 'Image', () => {
expect( src ).toMatch( /\/wp-content\/uploads\// );
} );

test( 'uploads data url through blobs from raw handling', async ( {
editor,
page,
pageUtils,
} ) => {
const blobUrl = await page.evaluate( async () => {
const canvas = document.createElement( 'canvas' );
canvas.width = 20;
canvas.height = 20;

const ctx = canvas.getContext( '2d' );
ctx.fillStyle = 'red';
ctx.fillRect( 0, 0, 20, 20 );

return canvas.toDataURL( 'image/png' );
} );

pageUtils.setClipboardData( { html: `<img src="${ blobUrl }">` } );

await pageUtils.pressKeys( 'primary+v' );

const imageBlock = editor.canvas.locator(
'role=document[name="Block: Image"i]'
);
const image = imageBlock.locator( 'img[src^="http"]' );
const src = await image.getAttribute( 'src' );

expect( src ).toMatch( /\/wp-content\/uploads\// );
} );

test( 'should have keyboard navigable link UI popover', async ( {
editor,
page,
Expand Down

0 comments on commit 4c52e15

Please sign in to comment.