summaryrefslogtreecommitdiff
path: root/packages/webapi/test/options.js
blob: 0db1cbfe3e1f3b730c4b5f1c8808375f8fdb855d (plain) (blame)
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
import { expect } from 'chai'
import { polyfill } from '../mod.js'

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')
	})
})