2022-03-07 16:36:22 -05:00
|
|
|
import { assert, test } from '../run/test.setup.js'
|
|
|
|
import { polyfill } from '../mod.js'
|
|
|
|
|
|
|
|
test(() => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: 'Can exclude HTMLElement+',
|
|
|
|
test() {
|
|
|
|
const target = {}
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
polyfill(target, {
|
2022-03-07 16:37:50 -05:00
|
|
|
exclude: 'HTMLElement+',
|
2022-03-07 16:36:22 -05:00
|
|
|
})
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
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 = {}
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
polyfill(target, {
|
2022-03-07 16:37:50 -05:00
|
|
|
exclude: 'Event+',
|
2022-03-07 16:36:22 -05:00
|
|
|
})
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
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 = {}
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
polyfill(target, {
|
2022-03-07 16:37:50 -05:00
|
|
|
exclude: 'document',
|
2022-03-07 16:36:22 -05:00
|
|
|
})
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
assert.equal(Reflect.has(target, 'Document'), true)
|
|
|
|
assert.equal(Reflect.has(target, 'HTMLDocument'), true)
|
|
|
|
assert.equal(Reflect.has(target, 'document'), false)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
})
|