diff options
author | 2022-03-07 15:36:22 -0600 | |
---|---|---|
committer | 2022-03-07 15:36:22 -0600 | |
commit | f18ee36dc0abdc5c8ec87734de7962966d16fe65 (patch) | |
tree | c01a7034186cb0bbe5e1d042f4a5dd09bad21ed5 /packages/webapi/test/options.js | |
parent | 10a9c3412b4f6e8607687a74eafdb150d3222047 (diff) | |
download | astro-f18ee36dc0abdc5c8ec87734de7962966d16fe65.tar.gz astro-f18ee36dc0abdc5c8ec87734de7962966d16fe65.tar.zst astro-f18ee36dc0abdc5c8ec87734de7962966d16fe65.zip |
Add `@astrojs/webapi` package (#2729)@astrojs/webapi@0.11.0
* chore: add @astrojs/webapi
* chore: update package.json
* fix: update file case
* fix: remove lowercase file
* chore: update tests to use mocha
* chore: update LICENSE
Diffstat (limited to 'packages/webapi/test/options.js')
-rw-r--r-- | packages/webapi/test/options.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/webapi/test/options.js b/packages/webapi/test/options.js new file mode 100644 index 000000000..4b375fc82 --- /dev/null +++ b/packages/webapi/test/options.js @@ -0,0 +1,53 @@ +import { assert, test } from '../run/test.setup.js' +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) + }, + }, + ] +}) |