1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

docs: fix progress bar sizes for SKIP

This commit is contained in:
Terts Diepraam 2022-02-15 19:36:15 +01:00
parent 11e428d471
commit 824c6041ab

View file

@ -7,13 +7,18 @@ function progressBar(totals) {
totalTests += value; totalTests += value;
} }
const passPercentage = Math.round(100 * totals["PASS"] / totalTests); const passPercentage = Math.round(100 * totals["PASS"] / totalTests);
const skipPercentage = passPercentage + Math.round(100 * totals["PASS"] / totalTests); const skipPercentage = passPercentage + Math.round(100 * totals["SKIP"] / totalTests);
// The ternary expressions are used for some edge-cases where there are no failing test,
// but still a red (or beige) line shows up because of how CSS draws gradients.
bar.style = `background: linear-gradient( bar.style = `background: linear-gradient(
to right, to right,
var(--PASS) ${passPercentage}%, var(--PASS) ${passPercentage}%`
var(--SKIP) ${passPercentage}%, + ( passPercentage === 100 ? ", var(--PASS)" :
var(--SKIP) ${skipPercentage}%, `, var(--SKIP) ${passPercentage}%,
var(--FAIL) 0)`; var(--SKIP) ${skipPercentage}%`
)
+ (skipPercentage === 100 ? ")" : ", var(--FAIL) 0)");
const progress = document.createElement("div"); const progress = document.createElement("div");
progress.className = "progress" progress.className = "progress"