summaryrefslogtreecommitdiff
path: root/preact/test/browser/customBuiltInElements.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'preact/test/browser/customBuiltInElements.test.js')
-rw-r--r--preact/test/browser/customBuiltInElements.test.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/preact/test/browser/customBuiltInElements.test.js b/preact/test/browser/customBuiltInElements.test.js
new file mode 100644
index 0000000..eb8ce17
--- /dev/null
+++ b/preact/test/browser/customBuiltInElements.test.js
@@ -0,0 +1,40 @@
+import { createElement, render, Component } from 'preact';
+import { setupScratch, teardown } from '../_util/helpers';
+
+/** @jsx createElement */
+
+const runSuite = typeof customElements == 'undefined' ? xdescribe : describe;
+
+runSuite('customised built-in elements', () => {
+ let scratch;
+
+ beforeEach(() => {
+ scratch = setupScratch();
+ });
+
+ afterEach(() => {
+ teardown(scratch);
+ });
+
+ it('should create built in elements correctly', () => {
+ class Foo extends Component {
+ render() {
+ return <div is="built-in" />;
+ }
+ }
+
+ const spy = sinon.spy();
+
+ class BuiltIn extends HTMLDivElement {
+ connectedCallback() {
+ spy();
+ }
+ }
+
+ customElements.define('built-in', BuiltIn, { extends: 'div' });
+
+ render(<Foo />, scratch);
+
+ expect(spy).to.have.been.calledOnce;
+ });
+});