diff options
Diffstat (limited to 'packages/webapi/test/options.js')
-rw-r--r-- | packages/webapi/test/options.js | 91 |
1 files changed, 41 insertions, 50 deletions
diff --git a/packages/webapi/test/options.js b/packages/webapi/test/options.js index f322d708a..0db1cbfe3 100644 --- a/packages/webapi/test/options.js +++ b/packages/webapi/test/options.js @@ -1,53 +1,44 @@ -import { assert, test } from '../run/test.setup.js' +import { expect } from 'chai' 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) - }, - }, - ] +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') + }) }) |