import { html } from 'dhtml'
import { createRoot } from 'dhtml/client'
import { assert, assert_eq, test } from '../../../scripts/test/test.ts'
import { setup } from './setup.ts'
test('custom elements instantiate correctly', () => {
const { root, el } = setup()
class CustomElement extends HTMLElement {
#thingName?: string
get thingName() {
return this.#thingName
}
set thingName(value) {
this.#thingName = value?.toUpperCase()
}
constructor() {
super()
this.innerText = 'inside custom element'
}
}
customElements.define('custom-element', CustomElement)
root.render(html`
hello
`) assert_eq(el.innerHTML, ``) assert_eq(shadowRoot.innerHTML, `hello
`) })