diff options
| author | Brian Cully <bjc@spork.org> | 2025-07-28 10:18:58 -0400 |
|---|---|---|
| committer | Brian Cully <bjc@spork.org> | 2025-07-28 10:18:58 -0400 |
| commit | 21664833f7ede94d812135e1b4ce88c241b5bf69 (patch) | |
| tree | 37615692bff8ff5ae1f2f6755072769b6791bc39 /test-harness.mjs | |
| parent | 400ddcde87ab1fae3249710b4a269a2cad86a128 (diff) | |
| download | chords-21664833f7ede94d812135e1b4ce88c241b5bf69.tar.gz chords-21664833f7ede94d812135e1b4ce88c241b5bf69.zip | |
add simple test stub
Diffstat (limited to 'test-harness.mjs')
| -rw-r--r-- | test-harness.mjs | 15 |
1 files changed, 14 insertions, 1 deletions
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()); + } } |
