mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
fix(firefox): round down mouse coordinates (#10483)
This commit is contained in:
parent
7d3672899f
commit
6d3bb458f9
@ -113,8 +113,8 @@ export class RawMouseImpl implements input.RawMouse {
|
|||||||
type: 'mousemove',
|
type: 'mousemove',
|
||||||
button: 0,
|
button: 0,
|
||||||
buttons: toButtonsMask(buttons),
|
buttons: toButtonsMask(buttons),
|
||||||
x,
|
x: Math.floor(x),
|
||||||
y,
|
y: Math.floor(y),
|
||||||
modifiers: toModifiersMask(modifiers)
|
modifiers: toModifiersMask(modifiers)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -124,8 +124,8 @@ export class RawMouseImpl implements input.RawMouse {
|
|||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
button: toButtonNumber(button),
|
button: toButtonNumber(button),
|
||||||
buttons: toButtonsMask(buttons),
|
buttons: toButtonsMask(buttons),
|
||||||
x,
|
x: Math.floor(x),
|
||||||
y,
|
y: Math.floor(y),
|
||||||
modifiers: toModifiersMask(modifiers),
|
modifiers: toModifiersMask(modifiers),
|
||||||
clickCount
|
clickCount
|
||||||
});
|
});
|
||||||
@ -136,8 +136,8 @@ export class RawMouseImpl implements input.RawMouse {
|
|||||||
type: 'mouseup',
|
type: 'mouseup',
|
||||||
button: toButtonNumber(button),
|
button: toButtonNumber(button),
|
||||||
buttons: toButtonsMask(buttons),
|
buttons: toButtonsMask(buttons),
|
||||||
x,
|
x: Math.floor(x),
|
||||||
y,
|
y: Math.floor(y),
|
||||||
modifiers: toModifiersMask(modifiers),
|
modifiers: toModifiersMask(modifiers),
|
||||||
clickCount
|
clickCount
|
||||||
});
|
});
|
||||||
@ -149,8 +149,8 @@ export class RawMouseImpl implements input.RawMouse {
|
|||||||
await this._client.send('Page.dispatchWheelEvent', {
|
await this._client.send('Page.dispatchWheelEvent', {
|
||||||
deltaX,
|
deltaX,
|
||||||
deltaY,
|
deltaY,
|
||||||
x,
|
x: Math.floor(x),
|
||||||
y,
|
y: Math.floor(y),
|
||||||
deltaZ: 0,
|
deltaZ: 0,
|
||||||
modifiers: toModifiersMask(modifiers)
|
modifiers: toModifiersMask(modifiers)
|
||||||
});
|
});
|
||||||
|
@ -164,3 +164,13 @@ it('should tween mouse movement', async ({ page, browserName, isAndroid }) => {
|
|||||||
[200, 300]
|
[200, 300]
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should always round down', async ({ page, browserName, isAndroid }) => {
|
||||||
|
await page.evaluate(() => {
|
||||||
|
document.addEventListener('mousedown', event => {
|
||||||
|
window['result'] = [event.clientX, event.clientY];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await page.mouse.click(50.1, 50.9);
|
||||||
|
expect(await page.evaluate('result')).toEqual([50, 50]);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user