From 21664833f7ede94d812135e1b4ce88c241b5bf69 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 28 Jul 2025 10:18:58 -0400 Subject: add simple test stub --- test-harness.mjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test-harness.mjs') diff --git a/test-harness.mjs b/test-harness.mjs index 3af026c..6990ad0 100644 --- a/test-harness.mjs +++ b/test-harness.mjs @@ -4,6 +4,11 @@ export default class extends HTMLElement { console.debug('Registering Element', this.name, this); customElements.define(this.name, this); } + static get elements() { + return Array.from(document.querySelectorAll(this.name)); + } + + tests = [] connectedCallback() { console.debug('TestHarness#connectedCallback', this); @@ -16,7 +21,15 @@ export default class extends HTMLElement { const runLink = this.querySelector('a'); runLink.onclick = e => { e.preventDefault(); - console.debug('runlink clicked', e); + this.run(); }; } + + addTests(fn) { + this.tests.push(fn); + } + + run() { + this.tests.forEach(t => t()); + } } -- cgit v1.3