feat: add 'progress' rank icon (#2858)

This pull request allows users to replace the rank level with the rank progress
by setting the `rank_icon` query to `progress`.
This commit is contained in:
Rick Staa
2023-06-19 12:58:02 +02:00
committed by GitHub
parent 62080c019c
commit a362af0ebc
8 changed files with 40 additions and 5 deletions
+11 -1
View File
@@ -20,7 +20,7 @@ const stats = {
totalDiscussionsStarted: 10,
totalDiscussionsAnswered: 50,
contributedTo: 500,
rank: { level: "A+", score: 40 },
rank: { level: "A+", percentile: 40 },
};
describe("Test renderStatsCard", () => {
@@ -417,4 +417,14 @@ describe("Test renderStatsCard", () => {
});
expect(queryByTestId(document.body, "github-rank-icon")).toBeDefined();
});
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) + "%");
});
});