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 | |
| parent | 400ddcde87ab1fae3249710b4a269a2cad86a128 (diff) | |
| download | chords-21664833f7ede94d812135e1b4ce88c241b5bf69.tar.gz chords-21664833f7ede94d812135e1b4ce88c241b5bf69.zip | |
add simple test stub
| -rw-r--r-- | scale-tests.mjs | 4 | ||||
| -rw-r--r-- | test-harness.mjs | 15 | ||||
| -rw-r--r-- | tests.mjs | 6 |
3 files changed, 24 insertions, 1 deletions
diff --git a/scale-tests.mjs b/scale-tests.mjs new file mode 100644 index 0000000..8f08bb8 --- /dev/null +++ b/scale-tests.mjs @@ -0,0 +1,4 @@ +export default function() { + console.debug('scale tests'); + console.assert(0 === 0, '0 test'); +} 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()); + } } @@ -1,6 +1,12 @@ import TestHarness from './test-harness.mjs'; +import scaleTests from './scale-tests.mjs'; function init() { TestHarness.register(); + TestHarness.elements.forEach(e => { + e.addTests(scaleTests); + + e.run(); + }); } document.addEventListener('DOMContentLoaded', init); |
