fix(nav): swipe to go back works inside card modal (#25333)

resolves #25327
This commit is contained in:
Liam DeBeasi
2022-05-23 16:49:36 -04:00
committed by GitHub
parent 311c634d20
commit 0156be61cb
6 changed files with 181 additions and 38 deletions

View File

@@ -6,7 +6,9 @@ export const dragElementBy = async (
el: Locator | ElementHandle<SVGElement | HTMLElement>,
page: E2EPage,
dragByX = 0,
dragByY = 0
dragByY = 0,
startXCoord?: number,
startYCoord?: number
) => {
const boundingBox = await el.boundingBox();
@@ -16,8 +18,8 @@ export const dragElementBy = async (
);
}
const startX = boundingBox.x + boundingBox.width / 2;
const startY = boundingBox.y + boundingBox.height / 2;
const startX = startXCoord === undefined ? boundingBox.x + boundingBox.width / 2 : startXCoord;
const startY = startYCoord === undefined ? boundingBox.y + boundingBox.height / 2 : startYCoord;
const midX = startX + dragByX / 2;
const midY = startY + dragByY / 2;