@@ -158,14 +158,15 @@ describe('report-generator', () => {
158158 expect ( html ) . toContain ( 'aria-label="Next image"' ) ;
159159 } ) ;
160160
161- it ( 'should include lightbox panel with image, caption, and counter ' , ( ) => {
161+ it ( 'should include lightbox panel with image, caption, counter, and open link ' , ( ) => {
162162 const pair = testDir . createPngFilePair ( 'a.png' , 'red' , 'blue' ) ;
163163 const html = generateAndRead ( [ { pair, hasDifference : true , diffPercentage : 10 } ] ) ;
164164
165165 expect ( html ) . toContain ( 'class="lightbox-panel"' ) ;
166166 expect ( html ) . toContain ( 'class="lightbox-image"' ) ;
167167 expect ( html ) . toContain ( 'class="lightbox-caption"' ) ;
168168 expect ( html ) . toContain ( 'class="lightbox-counter"' ) ;
169+ expect ( html ) . toContain ( 'class="lightbox-link"' ) ;
169170 } ) ;
170171
171172 it ( 'should wrap images in button triggers instead of anchor tags' , ( ) => {
@@ -235,6 +236,32 @@ describe('report-generator', () => {
235236 expect ( html ) . toContain ( 'ArrowDown' ) ;
236237 } ) ;
237238
239+ it ( 'should render the open image link that opens in a new tab' , ( ) => {
240+ const pair = testDir . createPngFilePair ( 'a.png' , 'red' , 'blue' ) ;
241+ const html = generateAndRead ( [ { pair, hasDifference : true , diffPercentage : 10 } ] ) ;
242+
243+ expect ( html ) . toContain ( '<a class="lightbox-link"' ) ;
244+ expect ( html ) . toContain ( 'target="_blank"' ) ;
245+ expect ( html ) . toContain ( 'rel="noopener"' ) ;
246+ expect ( html ) . toContain ( '>Open image</a>' ) ;
247+ } ) ;
248+
249+ it ( 'should include script logic to update the open image link href' , ( ) => {
250+ const pair = testDir . createPngFilePair ( 'a.png' , 'red' , 'blue' ) ;
251+ const html = generateAndRead ( [ { pair, hasDifference : true , diffPercentage : 10 } ] ) ;
252+
253+ expect ( html ) . toContain ( '.lightbox-link' ) ;
254+ expect ( html ) . toContain ( 'link.href = img.src' ) ;
255+ } ) ;
256+
257+ it ( 'should include CSS styles for the open image link' , ( ) => {
258+ const pair = testDir . createPngFilePair ( 'a.png' , 'red' , 'blue' ) ;
259+ const html = generateAndRead ( [ { pair, hasDifference : true , diffPercentage : 10 } ] ) ;
260+
261+ expect ( html ) . toContain ( '.lightbox-link' ) ;
262+ expect ( html ) . toContain ( 'text-decoration: none' ) ;
263+ } ) ;
264+
238265 it ( 'should include lightbox CSS with zoom-in cursor and dialog styles' , ( ) => {
239266 const pair = testDir . createPngFilePair ( 'a.png' , 'red' , 'blue' ) ;
240267 const html = generateAndRead ( [ { pair, hasDifference : true , diffPercentage : 10 } ] ) ;
0 commit comments