summaryrefslogtreecommitdiffstats
path: root/test-harness.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'test-harness.mjs')
-rw-r--r--test-harness.mjs15
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());
+ }
}