Skip to content

Commit

Permalink
Use slow dragging only for tables
Browse files Browse the repository at this point in the history
  • Loading branch information
areznik10 committed May 8, 2024
1 parent 7e5b42e commit 25d2e79
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/lexical-playground/__tests__/utils/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ export async function dragMouse(
positionStart = 'middle',
positionEnd = 'middle',
mouseUp = true,
slow = false,
) {
let fromX = fromBoundingBox.x;
let fromY = fromBoundingBox.y;
Expand All @@ -635,8 +636,11 @@ export async function dragMouse(
toY += toBoundingBox.height;
}

//simulate more than 1 mouse move event to replicate human dragging
await page.mouse.move((fromX + toX) / 2, (fromY + toY) / 2);
if (slow) {
//simulate more than 1 mouse move event to replicate human slow dragging
await page.mouse.move((fromX + toX) / 2, (fromY + toY) / 2);
}

await page.mouse.move(toX, toY);

if (mouseUp) {
Expand Down Expand Up @@ -795,6 +799,10 @@ export async function selectCellsFromTableCords(
page,
await firstRowFirstColumnCell.boundingBox(),
await secondRowSecondCell.boundingBox(),
'middle',
'middle',
true,
true,
);
}

Expand Down

0 comments on commit 25d2e79

Please sign in to comment.