Repository navigation
test(ui): read computed styles the same way on jsdom 30.1.3 - #516
Merged
Merged
Conversation
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
Deploying podnotes with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 avar()asunset, 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.background: var(--background-modifier-hover)now reads as the initial background, both asbackground(rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box) and asbackgroundColor. The test could not see which rule won. The tablet test in this file already works around the same jsdom limit forpadding. The hover test now declares eachbackground: var(asbackground-color: var(in the CSS it feeds jsdom, and readsbackgroundColor. Both versions read that longhand alike:var(--x)when declared,rgba(0, 0, 0, 0)when not.box-shadowas its initialnone, 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'svar(--shadow-s)and both--icon-sizevalues stay exact.package.jsonandpackage-lock.jsonare 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.tsreproduced the same 5 failures as #515's CI run 39777966136.After the change:
npm run testnpm run lintnpm run format:checknpm run typechecknpm run buildnpm run docs:buildThe lockfile was restored with
npm ciafter the 30.1.3 run.Mutants. Each mutant edits the component CSS. The run then checks
styles.test.tsand restores the file. Every mutant failed on both jsdom 30.1.2 and 30.1.3, with the same failing tests:PodcastView.svelte:@media (hover: hover)->@media all(guard removed)PodcastView.svelte: guard on(any-hover: hover)EpisodeRow.svelte: guard removedEpisodeRow.svelte: guard on(any-hover: hover)Deck.svelte: guard removedDeck.svelte: guard on(any-hover: hover)Player.svelte: guard removedPlayer.svelte: guard on(any-hover: hover)Player.svelte:.pn-stage > .pn-cover->.pn-stage .pn-coverEach 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
PodcastViewstyle tests to read computed styles on jsdom 30.1.3Adjusts styles.test.ts so style assertions match how jsdom 30.1.3 exposes computed styles. Rewrites generated
background: var(...)declarations tobackground-color: var(...)and readsbackgroundColorinstead of thebackgroundshorthand. 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.tschange; no production code or styling.Overview
Test-only updates to
PodcastViewstyle tests so they pass under jsdom 30.1.3, which computesbackground: var(...)shorthands differently and returnsnoneinstead of an empty string for unsetbox-shadow. No app CSS or runtime behavior changes.Hover “tap” cases now rewrite generated
background: var(rules tobackground-colorand assertbackgroundColor, with resting expectations set torgba(0, 0, 0, 0)where jsdom no longer reports an empty shorthand. The player stage test still checks stage artwork keepsvar(--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.