forked from rosa/hakurei
Compare commits
17 Commits
58b879f48f
...
a4f7756b67
| Author | SHA1 | Date | |
|---|---|---|---|
|
a4f7756b67
|
|||
|
9c18cc2d48
|
|||
|
0097bdd525
|
|||
|
04af503e40
|
|||
|
d7154e7157
|
|||
|
8314da68c2
|
|||
|
764ad34a2f
|
|||
|
2a1cde7896
|
|||
|
87ab8d6180
|
|||
|
9abfbc95b8
|
|||
|
1ce22a56b5
|
|||
|
8dbb1659bf
|
|||
|
ad49e4538b
|
|||
|
6da5d5a58a
|
|||
|
61f2837388
|
|||
|
32e5235359
|
|||
|
9624c224b8
|
@@ -281,8 +281,10 @@ export class StreamReporter implements Reporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function throwNotInDOMError(id: string): never {
|
function assertGetElementById(id: string): HTMLElement {
|
||||||
throw new ReferenceError(`element with ID '${id}' missing from DOM`);
|
let elem = document.getElementById(id);
|
||||||
|
if (elem == null) throw new ReferenceError(`element with ID '${id}' missing from DOM`);
|
||||||
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DOMReporter implements Reporter {
|
export class DOMReporter implements Reporter {
|
||||||
@@ -291,16 +293,12 @@ export class DOMReporter implements Reporter {
|
|||||||
update(path: string[], result: TestResult) {
|
update(path: string[], result: TestResult) {
|
||||||
if (path.length === 0) throw new RangeError("path is empty");
|
if (path.length === 0) throw new RangeError("path is empty");
|
||||||
if (result.state === "skip") {
|
if (result.state === "skip") {
|
||||||
const text = document.getElementById("skip-counter-text");
|
assertGetElementById("skip-counter-text").classList.remove("hidden");
|
||||||
if (!text) throwNotInDOMError("skip-counter-text");
|
|
||||||
text.classList.remove("hidden");
|
|
||||||
}
|
}
|
||||||
const counter = document.getElementById(`${result.state}-counter`);
|
const counter = assertGetElementById(`${result.state}-counter`);
|
||||||
if (!counter) throwNotInDOMError(`${result.state}-counter`);
|
|
||||||
counter.innerText = (Number(counter.innerText) + 1).toString();
|
counter.innerText = (Number(counter.innerText) + 1).toString();
|
||||||
|
|
||||||
let parent = document.getElementById("root");
|
let parent = assertGetElementById("root");
|
||||||
if (!parent) throwNotInDOMError("root");
|
|
||||||
for (const node of path) {
|
for (const node of path) {
|
||||||
let child: HTMLDetailsElement | null = null;
|
let child: HTMLDetailsElement | null = null;
|
||||||
let summary: HTMLElement | null = null;
|
let summary: HTMLElement | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user