feat(training): Standard / Pro switch on the driver's page; purple day-best lap and stint consistency (1.87.0)

This commit is contained in:
larssand committed 2026-11-09 22:44:47 +01:00
1 parent 73e1c0ccf3
commit 0caf50254a
13 files changed
+204 -28

No files matched your search

+14
View File
@@ -34,3 +34,17 @@ test("buildTrainingStintAnalysis rows carry their laps for the fold-out list", (
assert.deepEqual(rows[0].laps.map((lap) => lap.lapMs), [10_000, 13_000, 13_500]);
assert.equal(rows[0].averageLapMs, 12_167);
});
test("the day's fastest lap is purple, over every stint that day", () => {
const day = new Date(2026, 10, 9, 18).getTime();
const stints = [
{ id: "a", number: 1, startedAt: day, lapCount: 2, bestLapMs: 13300, laps: [{ lapMs: 13500 }, { lapMs: 13300 }] },
{ id: "b", number: 2, startedAt: day + 3600000, lapCount: 2, bestLapMs: 13100, laps: [{ lapMs: 13100 }, { lapMs: 13400 }] },
];
const html = renderStintLapCards(stints.slice(0, 1), { formatLap: fmt, formatDuration: fmt, escapeHtml, labels, allStints: stints });
assert.doesNotMatch(html, /is-day-best/, "the shown stint's best is not the day's best");
assert.match(html, /class="stint-lap is-best"/);
const both = renderStintLapCards(stints, { formatLap: fmt, formatDuration: fmt, escapeHtml, labels });
assert.equal((both.match(/class="stint-lap is-day-best"/g) || []).length, 1);
assert.equal(buildStintLapRows([{ lapMs: 13100 }], { dayBestMs: 13100 })[0].dayBest, true);
});