Skip to content

Commit 836922d

Browse files
committed
fix: handle failed chip image fallbacks
1 parent 8bab41a commit 836922d

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

atlas/js/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ function buildChipCarousel() {
799799
photo.setAttribute("fetchpriority", "low");
800800
photo.dataset.fallbackSrc = originalImageSrc(stop.imagePath);
801801
photo.src = thumbnailPhotoSrc(stop);
802-
photo.addEventListener("error", onChipPhotoError, { once: true });
802+
photo.addEventListener("error", onChipPhotoError);
803803
chip.appendChild(photo);
804804
}
805805

tests/test_atlas_static.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,17 @@ def test_app_loads_chip_thumbnails_instead_of_full_size_strip_images():
344344
assert "onChipPhotoError" in script
345345

346346

347+
def test_chip_thumbnail_error_handler_stays_active_for_fallback_failure():
348+
script = JS_PATH.read_text(encoding="utf-8")
349+
350+
build_chip_carousel = script[script.index("function buildChipCarousel") : script.index("function updateThemeNav")]
351+
352+
assert 'photo.addEventListener("error", onChipPhotoError);' in build_chip_carousel
353+
assert 'photo.addEventListener("error", onChipPhotoError, { once: true });' not in build_chip_carousel
354+
assert 'img.removeAttribute("data-fallback-src");' in script
355+
assert "img.remove();" in script
356+
357+
347358
def test_player_expand_and_minimize_use_bounded_crossfade_blur():
348359
css = CSS_PATH.read_text(encoding="utf-8")
349360
script = JS_PATH.read_text(encoding="utf-8")

0 commit comments

Comments
 (0)