fix lint snippets

This commit is contained in:
Yury Semikhatsky 2025-01-03 16:22:01 -08:00
parent a41f8c3627
commit 029dc5ef6c

View file

@ -48,14 +48,16 @@ async function pan(locator: Locator, deltaX?: number, deltaY?: number, steps?: n
clientX: centerX + deltaX * i / steps,
clientY: centerY + deltaY * i / steps,
}];
await locator.dispatchEvent('touchmove', { touches, changedTouches: touches, targetTouches: touches });
await locator.dispatchEvent('touchmove',
{ touches, changedTouches: touches, targetTouches: touches });
}
await locator.dispatchEvent('touchend');
}
test(`pan gesture to move the map`, async ({ page }) => {
await page.goto('https://www.google.com/maps/place/@37.4117722,-122.0713234,15z', { waitUntil: 'commit' });
await page.goto('https://www.google.com/maps/place/@37.4117722,-122.0713234,15z',
{ waitUntil: 'commit' });
await page.getByRole('button', { name: 'Keep using web' }).click();
await expect(page.getByRole('button', { name: 'Keep using web' })).not.toBeVisible();
// Get the map element.
@ -102,23 +104,26 @@ async function pinch(locator: Locator,
clientY: centerY,
},
];
await locator.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await locator.dispatchEvent('touchstart',
{ touches, changedTouches: touches, targetTouches: touches });
// Move the touch points towards or away from each other.
for (let i = 1; i <= steps; i++) {
const offset = (arg.direction === 'in' ? (deltaX - i * stepDeltaX) : (stepDeltaX * (i + 1)));
const touches = [
{
identifier: 0,
clientX: centerX - (arg.direction === 'in' ? (deltaX - i * stepDeltaX) : (stepDeltaX * (i + 1))),
clientX:centerX - offset,
clientY: centerY,
},
{
identifier: 0,
clientX: centerX + (arg.direction === 'in' ? (deltaX - i * stepDeltaX) : (stepDeltaX * (i + 1))),
clientX: centerX + offset,
clientY: centerY,
},
];
await locator.dispatchEvent('touchmove', { touches, changedTouches: touches, targetTouches: touches });
await locator.dispatchEvent('touchmove',
{ touches, changedTouches: touches, targetTouches: touches });
}
await locator.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });