forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdragAndDrop.test.ts
More file actions
65 lines (61 loc) · 1.8 KB
/
Copy pathdragAndDrop.test.ts
File metadata and controls
65 lines (61 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { silenceDebugMessages } from '../../helpers/setup'
import { JSDOM } from 'jsdom'
import {
makeDropTarget,
makeDraggable,
uploadFiles
} from '../../../src/widgets/dragAndDrop'
import { fetcher } from 'rdflib'
silenceDebugMessages()
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
const element = dom.createElement('div')
describe('makeDropTarget', () => {
it('exists', () => {
expect(makeDropTarget).toBeInstanceOf(Function)
})
it('runs', () => {
const handler = () => {}
expect(makeDropTarget(element, handler, handler)).toEqual(undefined)
})
it.skip('returns undefined when given an element ', () => {
const element = document.createElement('textarea')
const handler = () => {}
makeDropTarget(element, handler, handler)
const event = document.createEvent('HTMLEvents')
// debug.log(event)
event.initEvent('dragover', true, true)
// event.dataTransfer = () => {}
// element.dispatchEvent(event)
expect(element.dispatchEvent(event)).toReturn()
// debugger
// const event = new window.DragEvent
// window.dispatchEvent(event)
expect(makeDropTarget(element, handler, handler)).toMatchInlineSnapshot(
'undefined'
)
})
})
describe('makeDraggable', () => {
it('exists', () => {
expect(makeDraggable).toBeInstanceOf(Function)
})
it('runs', () => {
const tr = element
const obj = {}
expect(makeDraggable(tr, obj)).toEqual(undefined)
})
})
describe('uploadFiles', () => {
it('exists', () => {
expect(uploadFiles).toBeInstanceOf(Function)
})
it('runs', () => {
const files = []
const fileBase = ''
const imageBase = ''
const successHandler = () => {}
expect(
uploadFiles(fetcher, files, fileBase, imageBase, successHandler)
).toEqual(undefined)
})
})