feat(overlay): practice ranked on laps in a row shows only result, gap and best lap (1.89.6)

This commit is contained in:
larssand committed 2026-11-12 13:09:38 +01:00
1 parent 119619d6ff
commit 56be3d5918
9 files changed
+54 -15

No files matched your search

+16
View File
@@ -51,3 +51,19 @@ test("an Open Practice ranked on laps in a row or minutes keeps its result", asy
assert.equal(isOpenPracticeSession({ type: "free_practice", practiceRanking: "window" }), false);
assert.equal(isOpenPracticeSession({ type: "qualification" }), false);
});
test("practice ranked on 3 laps in a row: only result, gap and best lap as times (position, driver and next-lap bar stay)", async () => {
const { isPracticeRankedSession } = await import("../src/overlays.js");
assert.equal(isPracticeRankedSession({ type: "open_practice", practiceRanking: "consecutive" }), true);
assert.equal(isPracticeRankedSession({ type: "open_practice" }), false);
assert.equal(isPracticeRankedSession({ type: "final", practiceRanking: "consecutive" }), false);
const row = { key: "a", driverId: "a", displayName: "Anna", laps: 12, resultDisplay: "3 varv 55.123", gapDisplay: "+0.747s", gapAhead: "+0.2", lapDelta: "-0.1", bestLapMs: 18201, lastLapMs: 18777, predictedRemainingMs: 9000 };
const html = renderOverlayLeaderboard([row], deps, { practiceRank: true });
assert.match(html, /overlay-race-list-ranked/);
assert.match(html, /pos-pill pos-1">1</);
assert.match(html, /<label>table\.result<\/label>\s*<strong>3 varv 55\.123<\/strong>/);
assert.match(html, /<label>table\.gap<\/label>\s*<strong>\+0\.747s<\/strong>/);
assert.match(html, /<label>table\.best_lap<\/label>\s*<strong>18201<\/strong>/);
assert.match(html, /class="overlay-prediction"/, "the next-lap bar stays");
for (const gone of ["table.laps", "table.ahead_gap", "table.own_delta"]) assert.doesNotMatch(html, new RegExp(gone.replace(".", "\\.")), gone);
});