From d793e51a9ac108f23ffd098109a347e461ce46bc Mon Sep 17 00:00:00 2001 From: JoelEinbinder Date: Fri, 11 Aug 2017 13:59:23 -0700 Subject: [PATCH] Add a test that uses Modernizr to detect touch (#245) Add a test that uses Modernizr to detect touch --- test/assets/detect-touch.html | 16 ++++++++++++++++ test/test.js | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 test/assets/detect-touch.html diff --git a/test/assets/detect-touch.html b/test/assets/detect-touch.html new file mode 100644 index 00000000..96123b24 --- /dev/null +++ b/test/assets/detect-touch.html @@ -0,0 +1,16 @@ + + + + Detect Touch Test + + + + + + \ No newline at end of file diff --git a/test/test.js b/test/test.js index 635081dd..fb3831de 100644 --- a/test/test.js +++ b/test/test.js @@ -1429,6 +1429,13 @@ describe('Page', function() { return promise; } })); + it('should be detectable by Modernizr', SX(async function(){ + await page.goto(PREFIX + '/detect-touch.html'); + expect(await page.evaluate(() => document.body.textContent.trim())).toBe('NO'); + await page.setViewport(iPhone.viewport); + await page.goto(PREFIX + '/detect-touch.html'); + expect(await page.evaluate(() => document.body.textContent.trim())).toBe('YES'); + })); it('should support landscape emulation', SX(async function() { await page.goto(PREFIX + '/mobile.html'); expect(await page.evaluate(() => screen.orientation.type)).toBe('portrait-primary');