2022-04-11 01:29:46 +00:00
|
|
|
import { expect } from 'chai'
|
2022-03-07 21:36:22 +00:00
|
|
|
import { polyfill } from '../mod.js'
|
|
|
|
|
2022-04-11 01:29:46 +00:00
|
|
|
describe('Options', () => {
|
|
|
|
it('Can exclude HTMLElement+', () => {
|
|
|
|
const target = {}
|
|
|
|
|
|
|
|
polyfill(target, {
|
|
|
|
exclude: 'HTMLElement+',
|
|
|
|
})
|
|
|
|
|
|
|
|
expect(target).to.have.property('Event')
|
|
|
|
expect(target).to.have.property('EventTarget')
|
|
|
|
expect(target).to.have.property('Element')
|
|
|
|
expect(target).to.not.have.property('HTMLElement')
|
|
|
|
expect(target).to.not.have.property('HTMLDivElement')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Can exclude Event+', () => {
|
|
|
|
const target = {}
|
|
|
|
|
|
|
|
polyfill(target, {
|
|
|
|
exclude: 'Event+',
|
|
|
|
})
|
|
|
|
|
|
|
|
expect(target).to.not.have.property('Event')
|
|
|
|
expect(target).to.not.have.property('EventTarget')
|
|
|
|
expect(target).to.not.have.property('Element')
|
|
|
|
expect(target).to.not.have.property('HTMLElement')
|
|
|
|
expect(target).to.not.have.property('HTMLDivElement')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Can exclude document', () => {
|
|
|
|
const target = {}
|
|
|
|
|
|
|
|
polyfill(target, {
|
|
|
|
exclude: 'document',
|
|
|
|
})
|
|
|
|
|
|
|
|
expect(target).to.have.property('Document')
|
|
|
|
expect(target).to.have.property('HTMLDocument')
|
|
|
|
expect(target).to.not.have.property('document')
|
|
|
|
})
|
2022-03-07 21:36:22 +00:00
|
|
|
})
|