fix(click): revert layout shift logic (#10653)
This commit is contained in:
parent
5c93066437
commit
6e00af3b2e
|
|
@ -407,7 +407,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
|
||||||
const point = roundPoint(maybePoint);
|
const point = roundPoint(maybePoint);
|
||||||
progress.metadata.point = point;
|
progress.metadata.point = point;
|
||||||
|
|
||||||
if (process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK)
|
if (!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK)
|
||||||
return this._finishPointerAction(progress, actionName, point, options, action);
|
return this._finishPointerAction(progress, actionName, point, options, action);
|
||||||
else
|
else
|
||||||
return this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);
|
return this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ it('should block all events when hit target is wrong', async ({ page, server })
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should block click when mousedown succeeds but mouseup fails', async ({ page, server }) => {
|
it('should block click when mousedown succeeds but mouseup fails', async ({ page, server }) => {
|
||||||
|
it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);
|
||||||
|
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
await page.$eval('button', button => {
|
await page.$eval('button', button => {
|
||||||
button.addEventListener('mousedown', () => {
|
button.addEventListener('mousedown', () => {
|
||||||
|
|
@ -82,6 +84,8 @@ it('should click when element detaches in mousedown', async ({ page, server }) =
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not block programmatic events', async ({ page, server }) => {
|
it('should not block programmatic events', async ({ page, server }) => {
|
||||||
|
it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);
|
||||||
|
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
await page.$eval('button', button => {
|
await page.$eval('button', button => {
|
||||||
button.addEventListener('mousedown', () => {
|
button.addEventListener('mousedown', () => {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ it('trial run should not tap', async ({ page }) => {
|
||||||
await page.tap('#a');
|
await page.tap('#a');
|
||||||
const eventsHandle = await trackEvents(await page.$('#b'));
|
const eventsHandle = await trackEvents(await page.$('#b'));
|
||||||
await page.tap('#b', { trial: true });
|
await page.tap('#b', { trial: true });
|
||||||
const expected = process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];
|
const expected = !process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];
|
||||||
expect(await eventsHandle.jsonValue()).toEqual(expected);
|
expect(await eventsHandle.jsonValue()).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue