feat: add 'progress' rank icon

This commit gives users the ability to show the `progress` compared to
the highest possible rank in the stats card.
This commit is contained in:
rickstaa
2023-06-22 10:45:25 +02:00
parent f282ce4d64
commit 3afe547077
4 changed files with 19 additions and 3 deletions
+10
View File
@@ -431,4 +431,14 @@ describe("Test renderStatsCard", () => {
queryByTestId(document.body, "percentile-rank-value").textContent.trim(),
).toBe(stats.rank.percentile.toFixed(1) + "%");
});
it("should show the progress", () => {
document.body.innerHTML = renderStatsCard(stats, {
rank_icon: "progress",
});
expect(queryByTestId(document.body, "rank-progress-text")).toBeDefined();
expect(
queryByTestId(document.body, "progress-rank-icon").textContent.trim(),
).toBe((100 - stats.rank.percentile).toFixed(1) + "%");
});
});