Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tsTest("'no-missing-element-type-definition' reports diagnostic when element is
hasDiagnostic(t, diagnostics, "no-missing-element-type-definition");
});

tsTest("'no-missing-element-type-definition' reports no diagnostic when element is not in HTMLElementTagNameMap", t => {
tsTest("'no-missing-element-type-definition' reports no diagnostic when element is in HTMLElementTagNameMap", t => {
const { diagnostics } = getDiagnostics(
`
class MyElement extends HTMLElement { };
Expand All @@ -34,3 +34,24 @@ tsTest("'no-missing-element-type-definition' reports no diagnostic when element

hasNoDiagnostics(t, diagnostics);
});

tsTest("'no-missing-element-type-definition' reports no diagnostic when element is in HTMLElementTagNameMap using class property", t => {
const { diagnostics } = getDiagnostics(
`
class MyElement extends HTMLElement {
static readonly TAG_NAME = "my-element"
};
customElements.define(MyElement.TAG_NAME, MyElement)
declare global {
interface HTMLElementTagNameMap {
[MyElement.TAG_NAME]: MyElement
}
}
`,
{
rules: { "no-missing-element-type-definition": true }
}
);

hasNoDiagnostics(t, diagnostics);
});