2022-03-07 21:36:22 +00:00
|
|
|
import { assert, test } from '../run/test.setup.js'
|
|
|
|
import { polyfill } from '../mod.js'
|
|
|
|
|
|
|
|
test(() => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: 'Includes polyfill.internals functionality',
|
|
|
|
test() {
|
|
|
|
const target = {}
|
2022-03-07 21:37:50 +00:00
|
|
|
|
2022-03-07 21:36:22 +00:00
|
|
|
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)
|
|
|
|
|
2022-03-07 21:37:50 +00:00
|
|
|
assert.equal(
|
|
|
|
CustomElement.prototype.isPrototypeOf(
|
|
|
|
pseudo.document.createElement('custom-element')
|
|
|
|
),
|
|
|
|
true
|
|
|
|
)
|
2022-03-07 21:36:22 +00:00
|
|
|
},
|
2022-03-07 21:37:50 +00:00
|
|
|
},
|
2022-03-07 21:36:22 +00:00
|
|
|
]
|
|
|
|
})
|