Skip to content

Commit 3977b90

Browse files
authored
tests:: allow gradient themes (anuraghazra#3401)
1 parent f8aa2db commit 3977b90

4 files changed

+16
-12
lines changed

tests/renderGistCard.test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ describe("test renderGistCard", () => {
135135
);
136136
expect(descClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
137137
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
138-
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
139-
"fill",
140-
`#${themes[name].bg_color}`,
138+
const backgroundElement = queryByTestId(document.body, "card-bg");
139+
const backgroundElementFill = backgroundElement.getAttribute("fill");
140+
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
141+
backgroundElementFill,
141142
);
142143
});
143144
});

tests/renderRepoCard.test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ describe("Test renderRepoCard", () => {
190190
);
191191
expect(descClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
192192
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
193-
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
194-
"fill",
195-
`#${themes[name].bg_color}`,
193+
const backgroundElement = queryByTestId(document.body, "card-bg");
194+
const backgroundElementFill = backgroundElement.getAttribute("fill");
195+
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
196+
backgroundElementFill,
196197
);
197198
});
198199
});

tests/renderStatsCard.test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,10 @@ describe("Test renderStatsCard", () => {
264264
);
265265
expect(statClassStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
266266
expect(iconClassStyles.fill.trim()).toBe(`#${themes[name].icon_color}`);
267-
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
268-
"fill",
269-
`#${themes[name].bg_color}`,
267+
const backgroundElement = queryByTestId(document.body, "card-bg");
268+
const backgroundElementFill = backgroundElement.getAttribute("fill");
269+
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
270+
backgroundElementFill,
270271
);
271272
});
272273
});

tests/renderTopLanguagesCard.test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,10 @@ describe("Test renderTopLanguages", () => {
524524

525525
expect(headerStyles.fill.trim()).toBe(`#${themes[name].title_color}`);
526526
expect(langNameStyles.fill.trim()).toBe(`#${themes[name].text_color}`);
527-
expect(queryByTestId(document.body, "card-bg")).toHaveAttribute(
528-
"fill",
529-
`#${themes[name].bg_color}`,
527+
const backgroundElement = queryByTestId(document.body, "card-bg");
528+
const backgroundElementFill = backgroundElement.getAttribute("fill");
529+
expect([`#${themes[name].bg_color}`, "url(#gradient)"]).toContain(
530+
backgroundElementFill,
530531
);
531532
});
532533
});

0 commit comments

Comments
 (0)