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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
613 B
JavaScript
Raw Normal View History

import { expect } from 'chai'
import { polyfill } from '../mod.js'
it('Includes polyfill.internals functionality', () => {
const target = {}
2022-03-07 16:37:50 -05:00
polyfill(target, { exclude: 'window document' })
const pseudo = { ...target }
expect(pseudo).to.not.have.property('document')
const CustomElement = class extends pseudo.HTMLElement {}
pseudo.customElements.define('custom-element', CustomElement)
polyfill.internals(pseudo, 'Document')
expect(pseudo).to.have.property('document')
expect(
CustomElement.prototype.isPrototypeOf(
pseudo.document.createElement('custom-element')
)
).to.equal(true)
})