mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-18 19:26:04 +00:00
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:
@@ -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) + "%");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user