Repository navigation
Milestone 4: card DOM - #5
Merged
Merged
Conversation
showArtwork adds or reuses one decorative img as the first child of the card's info container and keeps it hidden until it loads, so a failed load never shows a broken icon. Sources that fail isUsableSrc remove the image. removeArtwork takes it out again. Tests run against the recorded Zen 1.24.3b card fixture.
The artwork URL comes from the page being played, so the browser UI should not leak its own referrer to that host. The failed-load test now also checks that the image stays in the card, so it catches a regression that removes the element instead of hiding it.
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.
What does this change?
Milestone 4 of the roadmap:
src/card.jsadds, updates and removes the artwork image in a media card.showArtwork(card, src)adds one HTML<img class="zen-media-viz-artwork" alt="">as the first item of the card's.zen-media-info-container, created through the card's own document. It reuses the image when the artwork changes and leaves it alone when the source is unchanged.isUsableSrc(https:or imagedata:) are set. Anything else, includingnull, removes the image.removeArtwork(card)removes the image and leaves the card as it was.The bundle
zen-media-viz.uc.jsis unchanged becausesrc/index.jsdoes not import the module yet. Wiring happens in Milestone 5, and styling in Milestone 6.How was it tested?
test/card.test.jsruns against the recorded Zen 1.24.3b card (test/fixtures/zen-1.24.3b.json) under happy-dom.npm test,npm run lint,npm run format:checkandnpm run check:bundlepass locally.browser.xhtmlis verified once the mod runs in Zen (Milestone 5).Checklist
npm test)npm run lintandnpm run format:checkpassnpm run build) if anything insrc/changed (not needed here: the bundle is unchanged)docs/manual-testing.mdchecked in a real Zen + Sine install (Milestone 5)CHANGELOG.mdupdated under Unreleased