test: add a test for screen.avail{Width,Height} emulation (#4011)

This currently does not work in WebKit.
This commit is contained in:
Dmitry Gozman 2020-09-30 04:14:29 -07:00 committed by GitHub
parent e28083974d
commit ccc827cd87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,14 @@ it('should emulate device height', async ({page, server}) => {
expect(await page.evaluate(() => matchMedia('(device-height: 500px)').matches)).toBe(true);
});
it('should emulate availWidth and availHeight', (test, { browserName, platform }) => {
test.fail(browserName === 'webkit' && platform !== 'linux', 'Not implemented');
}, async ({page}) => {
await page.setViewportSize({width: 500, height: 600});
expect(await page.evaluate(() => window.screen.availWidth)).toBe(500);
expect(await page.evaluate(() => window.screen.availHeight)).toBe(600);
});
it('should not have touch by default', async ({page, server}) => {
await page.goto(server.PREFIX + '/mobile.html');
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);