uppy/packages/@uppy/utils/src/isTouchDevice.test.js
Renée Kooi 2e257b7e55
Move utils files to @uppy/utils package.
And rewrite all the require calls.

```bash
git mv src/utils/* packages/@uppy/utils/src
sed -i 's/[./]*\/utils\//@uppy\/utils\/lib\//' src/**/*.js # transform (../)*utils → @uppy/utils
```
2018-06-14 16:31:19 +02:00

23 lines
668 B
JavaScript

const isTouchDevice = require('./isTouchDevice')
describe('isTouchDevice', () => {
const RealTouchStart = global.window.ontouchstart
const RealMaxTouchPoints = global.navigator.maxTouchPoints
beforeEach(() => {
global.window.ontouchstart = true
global.navigator.maxTouchPoints = 1
})
afterEach(() => {
global.navigator.maxTouchPoints = RealMaxTouchPoints
global.window.ontouchstart = RealTouchStart
})
xit("should return true if it's a touch device", () => {
expect(isTouchDevice()).toEqual(true)
delete global.window.ontouchstart
global.navigator.maxTouchPoints = false
expect(isTouchDevice()).toEqual(false)
})
})