Skip to content

Commit ccc827c

Browse files
authored
test: add a test for screen.avail{Width,Height} emulation (#4011)
This currently does not work in WebKit.
1 parent e280839 commit ccc827c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/browsercontext-viewport.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ it('should emulate device height', async ({page, server}) => {
8282
expect(await page.evaluate(() => matchMedia('(device-height: 500px)').matches)).toBe(true);
8383
});
8484

85+
it('should emulate availWidth and availHeight', (test, { browserName, platform }) => {
86+
test.fail(browserName === 'webkit' && platform !== 'linux', 'Not implemented');
87+
}, async ({page}) => {
88+
await page.setViewportSize({width: 500, height: 600});
89+
expect(await page.evaluate(() => window.screen.availWidth)).toBe(500);
90+
expect(await page.evaluate(() => window.screen.availHeight)).toBe(600);
91+
});
92+
8593
it('should not have touch by default', async ({page, server}) => {
8694
await page.goto(server.PREFIX + '/mobile.html');
8795
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);

0 commit comments

Comments
 (0)