summaryrefslogtreecommitdiff
path: root/packages/webapi/test/internals.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/webapi/test/internals.js')
-rw-r--r--packages/webapi/test/internals.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/webapi/test/internals.js b/packages/webapi/test/internals.js
new file mode 100644
index 000000000..84f918fb6
--- /dev/null
+++ b/packages/webapi/test/internals.js
@@ -0,0 +1,29 @@
+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)
+ },
+ }
+ ]
+})