Skip to content

test(ui): read computed styles the same way on jsdom 30.1.3 - #516

Merged
chhoumann merged 1 commit into
masterfrom
test/jsdom-30-1-3
Oct 23, 2026
Merged

chhoumann merged 1 commit into
masterfrom
test/jsdom-30-1-3

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

This is a test-only change, with no user-facing change and no CSS change. It lets the jsdom 30.1.2 -> 30.1.3 bump in #515 pass src/ui/PodcastView/styles.test.ts. That PR's Unit tests job fails 5 tests in this file.

Cause. jsdom 30.1.3 rewrote its cascade (lib/jsdom/living/css/helpers/computed-style.js). It now cascades each longhand of a shorthand that holds a var() as unset, because it does not substitute variables yet (its own TODO: "these declarations are invalid at computed-value time"). That matches the spec for an undefined variable. Selector and media matching are unchanged.

  • Hover cases (4 tests). A rule's background: var(--background-modifier-hover) now reads as the initial background, both as background (rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box) and as backgroundColor. The test could not see which rule won. The tablet test in this file already works around the same jsdom limit for padding. The hover test now declares each background: var( as background-color: var( in the CSS it feeds jsdom, and reads backgroundColor. Both versions read that longhand alike: var(--x) when declared, rgba(0, 0, 0, 0) when not.
  • Stage case (1 test). 30.1.3 reads an undeclared box-shadow as its initial none, where 30.1.2 read "". The row's cover now asserts that it does not take the stage's --shadow-s, which is the test's claim. The artwork's var(--shadow-s) and both --icon-size values stay exact.

package.json and package-lock.json are unchanged and match master.

Related: #515

Verification

Node v22.23.4 (fnm exec --using 22.23.2). No Obsidian run, since this changes only a jsdom test.

Before the change, on jsdom 30.1.3 (npm install --no-save jsdom@30.1.3), npx vitest run src/ui/PodcastView/styles.test.ts reproduced the same 5 failures as #515's CI run 39777966136.

After the change:

jsdom 30.1.2 (master's lockfile) jsdom 30.1.3
npm run test 126 files, 2782 tests passed; svelte-check 0 errors, 0 warnings 126 files, 2782 tests passed
npm run lint exit 0 -
npm run format:check exit 0 -
npm run typecheck exit 0 -
npm run build exit 0 -
npm run docs:build exit 0, 22 pages -

The lockfile was restored with npm ci after the 30.1.3 run.

Mutants. Each mutant edits the component CSS. The run then checks styles.test.ts and restores the file. Every mutant failed on both jsdom 30.1.2 and 30.1.3, with the same failing tests:

Mutant Failing tests
PodcastView.svelte: @media (hover: hover) -> @media all (guard removed) "only a device that can hover lights up anything in the view", "Back keeps its resting background after a tap"
PodcastView.svelte: guard on (any-hover: hover) same two
EpisodeRow.svelte: guard removed static guard test, "a row keeps its resting background after a tap"
EpisodeRow.svelte: guard on (any-hover: hover) same two
Deck.svelte: guard removed static guard test, "the skip button keeps its resting background after a tap"
Deck.svelte: guard on (any-hover: hover) same two
Player.svelte: guard removed static guard test, "the panel switch that is on keeps its resting background after a tap"
Player.svelte: guard on (any-hover: hover) same two
Player.svelte: .pn-stage > .pn-cover -> .pn-stage .pn-cover "dresses its own artwork, not the covers of a panel's rows shown in it"

Each removed guard fails its own tap case, not only the static guard scan. If the compiled CSS ever stopped matching the background: var( rewrite, the tap tests would fail loudly rather than pass.

Release impact

None.

Note

Update PodcastView style tests to read computed styles on jsdom 30.1.3

Adjusts styles.test.ts so style assertions match how jsdom 30.1.3 exposes computed styles. Rewrites generated background: var(...) declarations to background-color: var(...) and reads backgroundColor instead of the background shorthand. Also relaxes the row artwork box-shadow assertion to only require that it does not contain the stage shadow variable.

Macroscope summarized 1f011c5.


Note

Low Risk
Only test assertions in styles.test.ts change; no production code or styling.

Overview
Test-only updates to PodcastView style tests so they pass under jsdom 30.1.3, which computes background: var(...) shorthands differently and returns none instead of an empty string for unset box-shadow. No app CSS or runtime behavior changes.

Hover “tap” cases now rewrite generated background: var( rules to background-color and assert backgroundColor, with resting expectations set to rgba(0, 0, 0, 0) where jsdom no longer reports an empty shorthand. The player stage test still checks stage artwork keeps var(--shadow-s) but only requires row covers not to use that shadow token, instead of expecting an empty shadow string.

Reviewed by Cursor Bugbot for commit 1f011c5. Bugbot is set up for automated code reviews on this repo. Configure here.

jsdom 30.1.3 cascades each longhand of a shorthand that holds a var()
as unset, since it does not substitute variables yet. A hover rule's
`background: var(--background-modifier-hover)` then reads as the
initial background, so the tap tests could not see which rule won.
They now read backgroundColor with each such background declared as
its color, which jsdom 30.1.2 and 30.1.3 read alike.

jsdom 30.1.3 also reads an undeclared box-shadow as its initial `none`
where 30.1.2 read an empty string, so the stage test asserts that a
row's cover does not take the stage's shadow.

Related: #515
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Deploying podnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1f011c5
Status: ✅  Deploy successful!
Preview URL: https://274601db.podnotes.pages.dev
Branch Preview URL: https://test-jsdom-30-1-3.podnotes.pages.dev

View logs

@chhoumann
chhoumann marked this pull request as ready for review October 23, 2026 07:22
@chhoumann
chhoumann merged commit a35755f into master Oct 23, 2026
21 checks passed
@chhoumann
chhoumann deleted the test/jsdom-30-1-3 branch October 23, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant