Use progress element (#233)

This commit is contained in:
Camillo Bruni 2023-06-19 17:23:13 +02:00 committed by GitHub
parent d50264b547
commit 42a7b3b5d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -41,7 +41,7 @@
</a>
<div id="testContainer"></div>
<div id="progress">
<div id="progress-completed"></div>
<progress aria-label="Progress" id="progress-completed"></progress>
</div>
<div id="info">
<div id="info-label"></div>

View file

@ -307,7 +307,6 @@ button.show-about {
left: 60px;
right: 60px;
height: 6px;
background-color: var(--inactive-color);
border-left: 6px solid var(--background);
border-right: 6px solid var(--background);
}
@ -317,7 +316,17 @@ button.show-about {
top: 0;
left: 0;
height: 6px;
width: 0;
width: 100%;
appearance: none;
border: none;
background-color: var(--inactive-color);
}
#progress-completed::-webkit-progress-value {
background-color: var(--foreground);
}
#progress-completed::-moz-progress-bar {
background-color: var(--foreground);
}

View file

@ -60,6 +60,7 @@ class MainBenchmarkClient {
return testsCount + suite.tests.length;
}, 0);
this.stepCount = params.iterationCount * totalSubtestsCount;
this._progressCompleted.max = this.stepCount;
this.suitesCount = enabledSuites.length;
const runner = new BenchmarkRunner(Suites, this);
runner.runMultipleIterations(params.iterationCount);
@ -79,7 +80,7 @@ class MainBenchmarkClient {
didRunTest() {
this._finishedTestCount++;
this._progressCompleted.style.width = `${(this._finishedTestCount * 100) / this.stepCount}%`;
this._progressCompleted.value = this._finishedTestCount;
}
didRunSuites(measuredValues) {