mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 22:17:06 +00:00
refactor: language card renderer refactor (#1184)
* refactor: language card render refactor * chore: change error msg
This commit is contained in:
@@ -198,7 +198,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[0]).toHaveAttribute(
|
||||
"width",
|
||||
"120.00",
|
||||
"120",
|
||||
);
|
||||
|
||||
expect(queryAllByTestId(document.body, "lang-name")[1]).toHaveTextContent(
|
||||
@@ -206,7 +206,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[1]).toHaveAttribute(
|
||||
"width",
|
||||
"120.00",
|
||||
"120",
|
||||
);
|
||||
|
||||
expect(queryAllByTestId(document.body, "lang-name")[2]).toHaveTextContent(
|
||||
@@ -214,7 +214,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[2]).toHaveAttribute(
|
||||
"width",
|
||||
"60.00",
|
||||
"60",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -228,25 +228,28 @@ describe("Test renderTopLanguages", () => {
|
||||
it("should render without rounding", () => {
|
||||
document.body.innerHTML = renderTopLanguages(langs, { border_radius: "0" });
|
||||
expect(document.querySelector("rect")).toHaveAttribute("rx", "0");
|
||||
document.body.innerHTML = renderTopLanguages(langs, { });
|
||||
document.body.innerHTML = renderTopLanguages(langs, {});
|
||||
expect(document.querySelector("rect")).toHaveAttribute("rx", "4.5");
|
||||
});
|
||||
|
||||
it("should render langs with specified langs_count", async () => {
|
||||
options = {
|
||||
langs_count: 1
|
||||
}
|
||||
langs_count: 1,
|
||||
};
|
||||
document.body.innerHTML = renderTopLanguages(langs, { ...options });
|
||||
expect(queryAllByTestId(document.body, "lang-name").length).toBe(options.langs_count)
|
||||
expect(queryAllByTestId(document.body, "lang-name").length).toBe(
|
||||
options.langs_count,
|
||||
);
|
||||
});
|
||||
|
||||
it("should render langs with specified langs_count even when hide is set", async () => {
|
||||
options = {
|
||||
hide: ["HTML"],
|
||||
langs_count: 2
|
||||
}
|
||||
langs_count: 2,
|
||||
};
|
||||
document.body.innerHTML = renderTopLanguages(langs, { ...options });
|
||||
expect(queryAllByTestId(document.body, "lang-name").length).toBe(options.langs_count)
|
||||
expect(queryAllByTestId(document.body, "lang-name").length).toBe(
|
||||
options.langs_count,
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user