mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
refactor: simplify EmulationManager (#2816)
EmualationManager used to be injecting touch hooks to properly support touch emulation. However, these are no longer necessary, since https://crbug.com/133915 is long fixed.
This commit is contained in:
@@ -1276,6 +1276,11 @@ module.exports.addTests = function({testRunner, expect, puppeteer, DeviceDescrip
|
||||
await page.goto(server.PREFIX + '/detect-touch.html');
|
||||
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('YES');
|
||||
});
|
||||
it('should detect touch when applying viewport with touches', async({page, server}) => {
|
||||
await page.setViewport({ width: 800, height: 600, hasTouch: true });
|
||||
await page.addScriptTag({url: server.PREFIX + '/modernizr.js'});
|
||||
expect(await page.evaluate(() => Modernizr.touchevents)).toBe(true);
|
||||
});
|
||||
it('should support landscape emulation', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/mobile.html');
|
||||
expect(await page.evaluate(() => screen.orientation.type)).toBe('portrait-primary');
|
||||
|
||||
Reference in New Issue
Block a user