Skip to content

Commit

Permalink
tests:: allow gradient themes (anuraghazra#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Oct 23, 2023
1 parent f8aa2db commit 3977b90
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions tests/renderGistCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ describe("test renderGistCard", () => {
);
expect(descClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
"fill",
`#${themes[name].bg_color}`,
const backgroundElement = queryByTestId(document.body, "card-bg");
const backgroundElementFill = backgroundElement.getAttribute("fill");
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
backgroundElementFill,
);
});
});
Expand Down
7 changes: 4 additions & 3 deletions tests/renderRepoCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ describe("Test renderRepoCard", () => {
);
expect(descClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
"fill",
`#${themes[name].bg_color}`,
const backgroundElement = queryByTestId(document.body, "card-bg");
const backgroundElementFill = backgroundElement.getAttribute("fill");
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
backgroundElementFill,
);
});
});
Expand Down
7 changes: 4 additions & 3 deletions tests/renderStatsCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ describe("Test renderStatsCard", () => {
);
expect(statClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
"fill",
`#${themes[name].bg_color}`,
const backgroundElement = queryByTestId(document.body, "card-bg");
const backgroundElementFill = backgroundElement.getAttribute("fill");
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
backgroundElementFill,
);
});
});
Expand Down
7 changes: 4 additions & 3 deletions tests/renderTopLanguagesCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,10 @@ describe("Test renderTopLanguages", () => {

expect(headerStyles.fill.trim()).toBe(`#${themes[name].title_color}`);
expect(langNameStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
"fill",
`#${themes[name].bg_color}`,
const backgroundElement = queryByTestId(document.body, "card-bg");
const backgroundElementFill = backgroundElement.getAttribute("fill");
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
backgroundElementFill,
);
});
});
Expand Down

1 comment on commit 3977b90

@vercel
Copy link

@vercel vercel bot commented on 3977b90 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.