fix(click): revert layout shift logic (#10653)

This commit is contained in:
Dmitry Gozman 2021-12-01 12:54:20 -08:00 committed by GitHub
parent 5c93066437
commit 6e00af3b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -407,7 +407,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
const point = roundPoint(maybePoint);
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);
else
return this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);

View File

@ -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.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);
await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => {
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.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);
await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => {
button.addEventListener('mousedown', () => {

View File

@ -48,7 +48,7 @@ it('trial run should not tap', async ({ page }) => {
await page.tap('#a');
const eventsHandle = await trackEvents(await page.$('#b'));
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);
});