Unverified Commit 9624cf6a authored by Liam's avatar Liam Committed by GitHub
Browse files

fix: stats hide_border bug (#151)



* fix: stats hide border bug

* fix white border on dark mode issue

* chore: refactor code & tests

Co-authored-by: default avataranuraghazra <hazru.anurag@gmail.com>
parent 7a851064
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -130,9 +130,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
    ? ""
    : `<text x="25" y="35" class="header">${name}'${apostrophe} GitHub Stats</text>`;

  const border = hide_border
    ? ""
    : `
  const border = `
    <rect 
      data-testid="card-bg"
      x="0.5"
@@ -142,6 +140,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
      rx="4.5"
      fill="${bgColor}"
      stroke="#E4E2E2"
      stroke-opacity="${hide_border ? 0 : 1}"
    />
  `;

+9 −1
Original line number Diff line number Diff line
@@ -71,8 +71,16 @@ describe("Test renderStatsCard", () => {

  it("should hide_border", () => {
    document.body.innerHTML = renderStatsCard(stats, { hide_border: true });
    expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
      "stroke-opacity",
      "0"
    );

    expect(queryByTestId(document.body, "card-bg")).not.toBeInTheDocument();
    document.body.innerHTML = renderStatsCard(stats, { hide_border: false });
    expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
      "stroke-opacity",
      "1"
    );
  });

  it("should hide_rank", () => {