mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-23 10:18:40 +00:00
Co-authored-by: Mikael Finstad <finstaden@gmail.com> Co-authored-by: Nick Rutten <2504906+nickrttn@users.noreply.github.com> Co-authored-by: Murderlon <merlijn@soverin.net> Co-authored-by: Artur Paikin <artur@arturpaikin.com>
24 lines
771 B
JavaScript
24 lines
771 B
JavaScript
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
import isTouchDevice from './isTouchDevice.ts'
|
|
|
|
describe('isTouchDevice', () => {
|
|
const RealTouchStart = globalThis.window.ontouchstart
|
|
const RealMaxTouchPoints = globalThis.navigator.maxTouchPoints
|
|
|
|
beforeEach(() => {
|
|
globalThis.window.ontouchstart = true
|
|
globalThis.navigator.maxTouchPoints = 1
|
|
})
|
|
|
|
afterEach(() => {
|
|
globalThis.navigator.maxTouchPoints = RealMaxTouchPoints
|
|
globalThis.window.ontouchstart = RealTouchStart
|
|
})
|
|
|
|
it.skip("should return true if it's a touch device", () => {
|
|
expect(isTouchDevice()).toEqual(true)
|
|
delete globalThis.window.ontouchstart
|
|
globalThis.navigator.maxTouchPoints = false
|
|
expect(isTouchDevice()).toEqual(false)
|
|
})
|
|
})
|