diff options
-rw-r--r-- | tap-snapshots/test/snapshot/image.js.test.cjs | 26 | ||||
-rw-r--r-- | test/snapshot/image.js | 12 |
2 files changed, 26 insertions, 12 deletions
diff --git a/tap-snapshots/test/snapshot/image.js.test.cjs b/tap-snapshots/test/snapshot/image.js.test.cjs index bee117e1..d87ab714 100644 --- a/tap-snapshots/test/snapshot/image.js.test.cjs +++ b/tap-snapshots/test/snapshot/image.js.test.cjs @@ -7,7 +7,7 @@ 'use strict' exports[`test/snapshot/image.js TAP image (snapshot) > content warnings via tags 1`] = ` <div class="reveal"> - <div class="image-container"><div class="image-inner-area"><img data-original-length="600" data-thumbs="large:800 medium:400 small:250" src="media/album-art/beyond-canon/cover.medium.jpg"></div></div> + <div class="image-container"><div class="image-inner-area"><img src="media/album-art/beyond-canon/cover.png"></div></div> <span class="reveal-text-container"> <span class="reveal-text"> cw: too cool for school @@ -19,24 +19,24 @@ exports[`test/snapshot/image.js TAP image (snapshot) > content warnings via tags ` exports[`test/snapshot/image.js TAP image (snapshot) > id with link 1`] = ` -<a id="banana" class="box image-link" href="foobar"><div class="image-container"><div class="image-inner-area"><img></div></div></a> +<a id="banana" class="box image-link" href="foobar"><div class="image-container"><div class="image-inner-area"><img src="foobar"></div></div></a> ` exports[`test/snapshot/image.js TAP image (snapshot) > id with square 1`] = ` -<div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img id="banana"></div></div></div></div> +<div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img id="banana" src="foobar"></div></div></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > id without link 1`] = ` -<div class="image-container"><div class="image-inner-area"><img id="banana"></div></div> +<div class="image-container"><div class="image-inner-area"><img id="banana" src="foobar"></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > lazy with square 1`] = ` -<noscript><div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img></div></div></div></div></noscript> -<div class="square js-hide"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img class="lazy"></div></div></div></div> +<noscript><div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img src="foobar"></div></div></div></div></noscript> +<div class="square js-hide"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img class="lazy" data-original="foobar"></div></div></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > link with file size 1`] = ` -<a class="box image-link" href="media/album-art/pingas/cover.png"><div class="image-container"><div class="image-inner-area"><img data-original-size="1000000" data-original-length="600" data-thumbs="large:800 medium:400 small:250" src="media/album-art/pingas/cover.medium.jpg"></div></div></a> +<a class="box image-link" href="media/album-art/pingas/cover.png"><div class="image-container"><div class="image-inner-area"><img src="media/album-art/pingas/cover.png"></div></div></a> ` exports[`test/snapshot/image.js TAP image (snapshot) > source missing 1`] = ` @@ -44,15 +44,19 @@ exports[`test/snapshot/image.js TAP image (snapshot) > source missing 1`] = ` ` exports[`test/snapshot/image.js TAP image (snapshot) > source via path 1`] = ` -<div class="image-container"><div class="image-inner-area"><img data-original-length="600" data-thumbs="large:800 medium:400 small:250" src="media/album-art/beyond-canon/cover.medium.jpg"></div></div> +<div class="image-container"><div class="image-inner-area"><img src="media/album-art/beyond-canon/cover.png"></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > source via src 1`] = ` -<div class="image-container"><div class="image-inner-area"><img></div></div> +<div class="image-container"><div class="image-inner-area"><img src="https://example.com/bananas.gif"></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > square 1`] = ` -<div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img></div></div></div></div> +<div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img src="foobar"></div></div></div></div> +` + +exports[`test/snapshot/image.js TAP image (snapshot) > thumb requested but source is gif 1`] = ` +<div class="image-container"><div class="image-inner-area"><img src="media/flash-art/5426.gif"></div></div> ` exports[`test/snapshot/image.js TAP image (snapshot) > thumbnail details 1`] = ` @@ -60,5 +64,5 @@ exports[`test/snapshot/image.js TAP image (snapshot) > thumbnail details 1`] = ` ` exports[`test/snapshot/image.js TAP image (snapshot) > width & height 1`] = ` -<div class="image-container"><div class="image-inner-area"><img width="600" height="400"></div></div> +<div class="image-container"><div class="image-inner-area"><img width="600" height="400" src="foobar"></div></div> ` diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 48dcfb69..8608ab69 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -4,15 +4,17 @@ import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { await evaluate.load(); - const quickSnapshot = (message, opts) => + const quickSnapshot = (message, {extraDependencies, ...opts}) => evaluate.snapshot(message, { name: 'image', extraDependencies: { + checkIfImagePathHasCachedThumbnails: path => !path.endsWith('.gif'), getSizeOfImagePath: () => 0, getDimensionsOfImagePath: () => [600, 600], getThumbnailEqualOrSmaller: () => 'medium', getThumbnailsAvailableForDimensions: () => [['large', 800], ['medium', 400], ['small', 250]], + ...extraDependencies, }, ...opts, }); @@ -106,6 +108,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { evaluate.snapshot('thumbnail details', { name: 'image', extraDependencies: { + checkIfImagePathHasCachedThumbnails: () => true, getSizeOfImagePath: () => 0, getDimensionsOfImagePath: () => [900, 1200], getThumbnailsAvailableForDimensions: () => @@ -117,4 +120,11 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { path: ['media.albumCover', 'beyond-canon', 'png'], }, }); + + quickSnapshot('thumb requested but source is gif', { + slots: { + thumb: 'medium', + path: ['media.flashArt', '5426', 'gif'], + }, + }); }); |