summaryrefslogtreecommitdiff
path: root/packages/webapi/test/options.js
diff options
context:
space:
mode:
authorGravatar Juan Martín Seery <me@juanm04.com> 2022-04-10 22:29:46 -0300
committerGravatar GitHub <noreply@github.com> 2022-04-10 18:29:46 -0700
commit1907255ca239a94b76b1fe3a844a35f0436b8e3d (patch)
treef4c9935e0ea92f07478fece6a60b85795b24143a /packages/webapi/test/options.js
parent47f20a189f5479b5e84f99e6feda3be7080e455f (diff)
downloadastro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.tar.gz
astro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.tar.zst
astro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.zip
chore: webapi test now use chai (#3048)
Diffstat (limited to 'packages/webapi/test/options.js')
-rw-r--r--packages/webapi/test/options.js91
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')
+ })
})