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
|
import { assert, test } from '../run/test.setup.js'
import { polyfill } from '../mod.js'
test(() => {
return [
{
name: 'Can exclude HTMLElement+',
test() {
const target = {}
polyfill(target, {
exclude: 'HTMLElement+'
})
assert.equal(Reflect.has(target, 'Event'), true)
assert.equal(Reflect.has(target, 'EventTarget'), true)
assert.equal(Reflect.has(target, 'Element'), true)
assert.equal(Reflect.has(target, 'HTMLElement'), false)
assert.equal(Reflect.has(target, 'HTMLDivElement'), false)
},
},
{
name: 'Can exclude Event+',
test() {
const target = {}
polyfill(target, {
exclude: 'Event+'
})
assert.equal(Reflect.has(target, 'Event'), false)
assert.equal(Reflect.has(target, 'EventTarget'), false)
assert.equal(Reflect.has(target, 'Element'), false)
assert.equal(Reflect.has(target, 'HTMLElement'), false)
assert.equal(Reflect.has(target, 'HTMLDivElement'), false)
},
},
{
name: 'Can exclude document',
test() {
const target = {}
polyfill(target, {
exclude: 'document'
})
assert.equal(Reflect.has(target, 'Document'), true)
assert.equal(Reflect.has(target, 'HTMLDocument'), true)
assert.equal(Reflect.has(target, 'document'), false)
},
},
]
})
|