Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/ui/PodcastView/styles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ describe("hover", () => {
".pn-back",
"rgba(0, 0, 0, 0)",
],
["a row", "EpisodeRow", '<div class="pn-ep {}%"></div>', ".pn-ep", ""],
["a row", "EpisodeRow", '<div class="pn-ep {}%"></div>', ".pn-ep", "rgba(0, 0, 0, 0)"],
[
"the skip button",
"Deck",
'<div class="pn-deck {}"><button class="pn-skip%"></button></div>',
".pn-skip",
"",
"rgba(0, 0, 0, 0)",
],
[
"the panel switch that is on",
Expand All @@ -123,9 +123,13 @@ describe("hover", () => {
"%s keeps its resting background after a tap",
(_name, component, html, selector, resting) => {
const background = (hovered: boolean, media: string[] = []) => {
const css = componentCss(["PodcastView", component], { media, states: ["hover"] });
// jsdom drops a var() in a shorthand, so each background stands in as its color.
const css = componentCss(["PodcastView", component], {
media,
states: ["hover"],
}).replaceAll("background: var(", "background-color: var(");
const markup = inView(component, html.replace("%", hovered ? " hover" : ""));
return getComputedStyle(styled(css, markup, selector)).background;
return getComputedStyle(styled(css, markup, selector)).backgroundColor;
};

expect([background(false), background(true), background(true, [HOVER])]).toEqual([
Expand Down Expand Up @@ -205,7 +209,7 @@ describe("the player's stage", () => {

expect([look("art"), look("row")]).toEqual([
{ shadow: "var(--shadow-s)", icon: "25cqw" },
{ shadow: "", icon: "18px" },
{ shadow: expect.not.stringContaining("--shadow-s"), icon: "18px" },
]);
});
});
Expand Down
Loading