feat: added hide_title option (#88)

This commit is contained in:
Anurag Hazra
2020-07-17 23:01:16 +05:30
committed by GitHub
parent 96f89ad2b7
commit 2709d5b434
4 changed files with 84 additions and 37 deletions

View File

@ -112,9 +112,39 @@ describe("Test renderStatsCard", () => {
);
});
it("should hide the title", () => {
document.body.innerHTML = renderStatsCard(stats, {
hide_title: true,
});
expect(document.getElementsByClassName("header")[0]).toBeUndefined();
expect(document.getElementsByTagName("svg")[0]).toHaveAttribute(
"height",
"165"
);
expect(queryByTestId(document.body, "card-body-content")).toHaveAttribute(
"transform",
"translate(0, -30)"
);
});
it("should not hide the title", () => {
document.body.innerHTML = renderStatsCard(stats, {});
expect(document.getElementsByClassName("header")[0]).toBeDefined();
expect(document.getElementsByTagName("svg")[0]).toHaveAttribute(
"height",
"195"
);
expect(queryByTestId(document.body, "card-body-content")).toHaveAttribute(
"transform",
"translate(0, 0)"
);
});
it("should render icons correctly", () => {
document.body.innerHTML = renderStatsCard(stats, {
show_icons: "true",
show_icons: true,
});
expect(queryAllByTestId(document.body, "icon")[0]).toBeDefined();