Skip to content

Commit

Permalink
Fix drop
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Nov 9, 2023
1 parent 15c664e commit 2c19ed1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 9 additions & 1 deletion packages/e2e-test-utils-playwright/src/page-utils/drag-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ async function dragFiles(
drop: async () => {
const topMostElement = await this.page.evaluateHandle(
( { x, y } ) => {
return document.elementFromPoint( x, y );
const element = document.elementFromPoint( x, y );
if ( element instanceof HTMLIFrameElement ) {
const offsetBox = element.getBoundingClientRect();
return element.contentDocument!.elementFromPoint(
x - offsetBox.x,
y - offsetBox.y
);
}
return element;
},
position
);
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/specs/editor/blocks/paragraph.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ test.describe( 'Paragraph', () => {
await expect( draggingUtils.dropZone ).toBeVisible();
await expect( draggingUtils.insertionIndicator ).toBeHidden();

await drop(
editor.canvas.locator( '[data-type="core/paragraph"]' )
);
await drop();

const imageBlock = editor.canvas.locator(
'role=document[name="Block: Image"i]'
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/draggable-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ test.describe( 'Draggable block', () => {
'Dragging over the empty group block but outside the appender should still show the blue background'
).toHaveCSS( 'background-color', 'rgb(0, 124, 186)' );

await drop( rowBlock );
await drop();
await expect( rowAppender ).toBeHidden();
await expect.poll( editor.getBlocks ).toMatchObject( [
{
Expand Down Expand Up @@ -446,7 +446,7 @@ test.describe( 'Draggable block', () => {
'rgb(0, 124, 186)'
);

await drop( columnAppender );
await drop();
await expect( columnAppender ).toBeHidden();
await expect.poll( editor.getBlocks ).toMatchObject( [
{ name: 'core/group' },
Expand Down

0 comments on commit 2c19ed1

Please sign in to comment.