feat(training): search, class filter and grouping in the club practice overview (1.89.18)
This commit is contained in:
1 parent
f8080ffaeb
commit
eefef11aaa
11 files changed
+129
-13
No files matched your search
@@ -58,6 +58,18 @@ export async function runTrainingSourceSmoke({ evaluate, navigate, savedState, w
|
||||
assert.equal(row[1], "🏁 TS Winter #3 TS 2WD · Kval 2 · TS Winter Cup", "race, session and series");
|
||||
assert.equal(row[2], "3");
|
||||
console.log("PASS training stats: practice by default; races shown per race session with 🏁 race · session · series, never as stints");
|
||||
|
||||
// The club table at the bottom of the overview: search and only drivers who trained.
|
||||
await evaluate(`location.href = ${JSON.stringify(`${base}/?view=training`)}`);
|
||||
await waitFor(async () => Boolean(await evaluate(`document.getElementById("trainingListSearch") && document.querySelector('tr[data-training-row][data-name="TS Driver"]')`)), "the club table with its toolbar");
|
||||
const visibleNames = () => evaluate(`[...document.querySelectorAll("tr[data-training-row]:not([hidden])")].map((tr) => tr.dataset.name)`);
|
||||
assert.ok((await visibleNames()).includes("TS Driver"), "a driver who trained is listed");
|
||||
await evaluate(`(() => { const input = document.getElementById("trainingListSearch"); input.value = "no such driver"; input.dispatchEvent(new Event("input")); })()`);
|
||||
assert.deepEqual(await visibleNames(), [], "the search hides the others");
|
||||
assert.equal(await evaluate(`document.querySelector("[data-training-list-none]").hidden`), false, "and says nothing matches");
|
||||
await evaluate(`(() => { const input = document.getElementById("trainingListSearch"); input.value = "ts dri"; input.dispatchEvent(new Event("input")); })()`);
|
||||
assert.deepEqual(await visibleNames(), ["TS Driver"]);
|
||||
console.log("PASS training stats: the club table has a search box that filters the drivers");
|
||||
} finally {
|
||||
const current = await savedState();
|
||||
const results = { ...current.resultsBySession };
|
||||
|
||||
@@ -47,3 +47,14 @@ test("deleting several drivers removes them from heats, participant lists and te
|
||||
assert.deepEqual(state.events[0].raceConfig.driverIds, ["a"]);
|
||||
assert.deepEqual(state.events[0].raceConfig.teams[0].driverIds, []);
|
||||
});
|
||||
|
||||
test("training stats table: search, one class and only drivers who trained", async () => {
|
||||
const { trainingRowVisible } = await import("../src/driver_list_logic.js");
|
||||
const row = { name: "Roy Andersson", classId: "c1", laps: 12 };
|
||||
assert.equal(trainingRowVisible(row), true);
|
||||
assert.equal(trainingRowVisible(row, { search: "roy" }), true);
|
||||
assert.equal(trainingRowVisible(row, { search: "eddie" }), false);
|
||||
assert.equal(trainingRowVisible(row, { classId: "c2" }), false);
|
||||
assert.equal(trainingRowVisible({ ...row, laps: 0 }, { activeOnly: true }), false);
|
||||
assert.equal(trainingRowVisible({ ...row, laps: 0 }), true);
|
||||
});
|
||||
Reference in new issue
Block a user