test: add a test for clicking a label with pointer-events: none (#2412)

This commit is contained in:
Dmitry Gozman 2020-05-29 13:46:57 -07:00 committed by GitHub
parent 767f6bfeb9
commit 4bd9b30376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -524,6 +524,17 @@ describe('Page.click', function() {
await clickPromise; await clickPromise;
expect(await page.evaluate(() => window.__CLICKED)).toBe(true); expect(await page.evaluate(() => window.__CLICKED)).toBe(true);
}); });
it('should wait for LABEL to be clickable when it has pointer-events:none', async({page, server}) => {
await page.setContent('<label onclick="javascript:window.__CLICKED=true;" style="pointer-events:none"><span>Click target</span></label>');
const clickPromise = page.click('text=Click target');
// Do a few roundtrips to the page.
for (let i = 0; i < 5; ++i)
expect(await page.evaluate(() => window.__CLICKED)).toBe(undefined);
// remove `pointer-events: none` css from button.
await page.evaluate(() => document.querySelector('label').style.removeProperty('pointer-events'));
await clickPromise;
expect(await page.evaluate(() => window.__CLICKED)).toBe(true);
});
it('should update modifiers correctly', async({page, server}) => { it('should update modifiers correctly', async({page, server}) => {
await page.goto(server.PREFIX + '/input/button.html'); await page.goto(server.PREFIX + '/input/button.html');
await page.click('button', { modifiers: ['Shift'] }); await page.click('button', { modifiers: ['Shift'] });