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