You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write tests for some web components which inherit from HTMLElement (or Element), and am working around the lack of customElements by mocking customElements.define() (with code that simply does nothing).
This is by design: if you run the same code in your browser, you'll get the same error. In the browser, you'd create custom elements using the document.createElement() API. However, deno-dom does not have support for custom element registry yet, and therefore the library does not currently provide a way to construct custom elements.
You'll also find that the constructor for your custom element is not a valid custom element constructor, so your code wouldn't work even in a browser.
I'm trying to write tests for some web components which inherit from
HTMLElement
(orElement
), and am working around the lack ofcustomElements
by mockingcustomElements.define()
(with code that simply does nothing).With that setup I run into this error:
category.js
looks like this (with line 15 being the call tosuper()
):The code that triggers the exception is just
new Category({name: "a name", color: "#abcdef"})
.Do you have an idea what's the issue here? Do I need an actual
CustomElementRegistry
? Or an actualHTMLElement
? Or am I doing something wrong?Thank you for your work and time!
The text was updated successfully, but these errors were encountered: