0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/webapi/test/internals.js
Nate Moore f18ee36dc0
Add @astrojs/webapi package (#2729)
* 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
2022-03-07 15:36:22 -06:00

29 lines
711 B
JavaScript

import { assert, test } from '../run/test.setup.js'
import { polyfill } from '../mod.js'
test(() => {
return [
{
name: 'Includes polyfill.internals functionality',
test() {
const target = {}
polyfill(target, { exclude: 'window document' })
const pseudo = { ...target }
assert.equal(Reflect.has(pseudo, 'document'), false)
const CustomElement = class extends pseudo.HTMLElement {}
pseudo.customElements.define('custom-element', CustomElement)
polyfill.internals(pseudo, 'Document')
assert.equal(Reflect.has(pseudo, 'document'), true)
assert.equal(CustomElement.prototype.isPrototypeOf(pseudo.document.createElement('custom-element')), true)
},
}
]
})