mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-31 18:19:23 +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:
@@ -42,6 +42,9 @@ exports[`Test Render Wakatime Card should render correctly with compact layout 1
|
||||
font: 800 24px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58;
|
||||
animation: scaleInAnimation 0.3s ease-in-out forwards;
|
||||
}
|
||||
.rank-progress-text {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.not_bold { font-weight: 400 }
|
||||
.bold { font-weight: 700 }
|
||||
@@ -222,6 +225,9 @@ exports[`Test Render Wakatime Card should render correctly with compact layout w
|
||||
font: 800 24px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58;
|
||||
animation: scaleInAnimation 0.3s ease-in-out forwards;
|
||||
}
|
||||
.rank-progress-text {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.not_bold { font-weight: 400 }
|
||||
.bold { font-weight: 700 }
|
||||
|
||||
@@ -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