forked from rosa/hakurei
Compare commits
17 Commits
a4f7756b67
...
58b879f48f
| Author | SHA1 | Date | |
|---|---|---|---|
|
58b879f48f
|
|||
|
252e9a4efc
|
|||
|
7cba25eb40
|
|||
|
20cfb8201c
|
|||
|
4385922bb8
|
|||
|
82c73c36cf
|
|||
|
dc883c9c49
|
|||
|
6888033e8d
|
|||
|
7c39b32470
|
|||
|
52b9b7754a
|
|||
|
0d0c659649
|
|||
|
47962b1f55
|
|||
|
f160d1ab7f
|
|||
|
9fbd26217a
|
|||
|
79e0bacf76
|
|||
|
d552b98d42
|
|||
|
795f27205c
|
@@ -281,10 +281,8 @@ export class StreamReporter implements Reporter {
|
||||
}
|
||||
}
|
||||
|
||||
function assertGetElementById(id: string): HTMLElement {
|
||||
let elem = document.getElementById(id);
|
||||
if (elem == null) throw new ReferenceError(`element with ID '${id}' missing from DOM`);
|
||||
return elem;
|
||||
function throwNotInDOMError(id: string): never {
|
||||
throw new ReferenceError(`element with ID '${id}' missing from DOM`);
|
||||
}
|
||||
|
||||
export class DOMReporter implements Reporter {
|
||||
@@ -293,12 +291,16 @@ export class DOMReporter implements Reporter {
|
||||
update(path: string[], result: TestResult) {
|
||||
if (path.length === 0) throw new RangeError("path is empty");
|
||||
if (result.state === "skip") {
|
||||
assertGetElementById("skip-counter-text").classList.remove("hidden");
|
||||
const text = document.getElementById("skip-counter-text");
|
||||
if (!text) throwNotInDOMError("skip-counter-text");
|
||||
text.classList.remove("hidden");
|
||||
}
|
||||
const counter = assertGetElementById(`${result.state}-counter`);
|
||||
const counter = document.getElementById(`${result.state}-counter`);
|
||||
if (!counter) throwNotInDOMError(`${result.state}-counter`);
|
||||
counter.innerText = (Number(counter.innerText) + 1).toString();
|
||||
|
||||
let parent = assertGetElementById("root");
|
||||
let parent = document.getElementById("root");
|
||||
if (!parent) throwNotInDOMError("root");
|
||||
for (const node of path) {
|
||||
let child: HTMLDetailsElement | null = null;
|
||||
let summary: HTMLElement | null = null;
|
||||
|
||||
Reference in New Issue
Block a user