@@ -478,7 +478,7 @@ describe('game_detail.js', () => {
478478 } ) ;
479479 const bigImgs = document . getElementById ( 'header-big-imgs' ) ;
480480 expect ( bigImgs . dataset . numImg ) . toBe ( '2' ) ;
481- expect ( bigImgs . getAttribute ( 'data-img-src-1' ) ) . toContain ( 'art1' ) ;
481+ expect ( bigImgs . dataset . imgSrc1 ) . toContain ( 'art1' ) ;
482482 } ) ;
483483
484484 test ( 'hides page heading when no artworks and heading exists' , ( ) => {
@@ -489,7 +489,7 @@ describe('game_detail.js', () => {
489489
490490 test ( 'does nothing when no artworks and no .page-heading in DOM' , ( ) => {
491491 const pageHeading = document . querySelector ( '.page-heading' ) ;
492- pageHeading . parentNode . removeChild ( pageHeading ) ;
492+ pageHeading . remove ( ) ;
493493 // Should not throw and should not affect any element
494494 expect ( ( ) => setupGameBanner ( { } ) ) . not . toThrow ( ) ;
495495 } ) ;
@@ -506,7 +506,7 @@ describe('game_detail.js', () => {
506506 test ( 'does not throw when artworks present but no intro-header.big-img' , ( ) => {
507507 // Remove intro-header from DOM entirely
508508 const introHeader = document . querySelector ( '.intro-header' ) ;
509- introHeader . parentNode . removeChild ( introHeader ) ;
509+ introHeader . remove ( ) ;
510510 expect ( ( ) => setupGameBanner ( {
511511 artworks : [ { url : '//images.igdb.com/t_thumb/art.jpg' } ] ,
512512 } ) ) . not . toThrow ( ) ;
@@ -515,7 +515,7 @@ describe('game_detail.js', () => {
515515 test ( 'skips pageHeading visibility when pageHeading absent (no .page-heading)' , ( ) => {
516516 // Remove page-heading from DOM
517517 const pageHeading = document . querySelector ( '.page-heading' ) ;
518- pageHeading . parentNode . removeChild ( pageHeading ) ;
518+ pageHeading . remove ( ) ;
519519 document . querySelector ( '.intro-header' ) . classList . add ( 'big-img' ) ;
520520 expect ( ( ) => setupGameBanner ( {
521521 artworks : [ { url : '//images.igdb.com/t_thumb/art.jpg' } ] ,
@@ -535,7 +535,7 @@ describe('game_detail.js', () => {
535535 test ( 'does not throw when artworks present but no .page-heading anywhere' , ( ) => {
536536 // Remove header.header-section entirely
537537 const header = document . querySelector ( 'header.header-section' ) ;
538- header . parentNode . removeChild ( header ) ;
538+ header . remove ( ) ;
539539 expect ( ( ) => setupGameBanner ( { artworks : [ { url : '//img.igdb.com/t.jpg' } ] } ) ) . not . toThrow ( ) ;
540540 } ) ;
541541 } ) ;
@@ -549,10 +549,10 @@ describe('game_detail.js', () => {
549549 test ( 'sets initial image and cycles when multiple artworks' , ( ) => {
550550 const bigImgs = document . getElementById ( 'header-big-imgs' ) ;
551551 bigImgs . dataset . numImg = '2' ;
552- bigImgs . setAttribute ( 'data-img-src-1' , 'https://example.com/art1.jpg' ) ;
553- bigImgs . setAttribute ( 'data-img-src-2' , 'https://example.com/art2.jpg' ) ;
554- bigImgs . setAttribute ( 'data-img-desc-1' , 'null' ) ;
555- bigImgs . setAttribute ( 'data-img-desc-2' , 'Artwork 2' ) ;
552+ bigImgs . dataset . imgSrc1 = 'https://example.com/art1.jpg' ;
553+ bigImgs . dataset . imgSrc2 = 'https://example.com/art2.jpg' ;
554+ bigImgs . dataset . imgDesc1 = 'null' ;
555+ bigImgs . dataset . imgDesc2 = 'Artwork 2' ;
556556
557557 const introHeader = document . querySelector ( '.intro-header' ) ;
558558 introHeader . classList . add ( 'big-img' ) ;
@@ -574,16 +574,16 @@ describe('game_detail.js', () => {
574574 test ( 'returns early when no intro-header.big-img found' , ( ) => {
575575 const bigImgs = document . getElementById ( 'header-big-imgs' ) ;
576576 bigImgs . dataset . numImg = '1' ;
577- bigImgs . setAttribute ( 'data-img-src-1' , 'https://example.com/art.jpg' ) ;
577+ bigImgs . dataset . imgSrc1 = 'https://example.com/art.jpg' ;
578578 // intro-header does NOT have big-img class — should return early
579579 expect ( ( ) => initGameBanner ( ) ) . not . toThrow ( ) ;
580580 } ) ;
581581
582582 test ( 'sets background image without crashing when no .img-desc inside intro-header' , ( ) => {
583583 const bigImgs = document . getElementById ( 'header-big-imgs' ) ;
584584 bigImgs . dataset . numImg = '1' ;
585- bigImgs . setAttribute ( 'data-img-src-1' , 'https://example.com/art.jpg' ) ;
586- bigImgs . setAttribute ( 'data-img-desc-1' , 'Some description' ) ;
585+ bigImgs . dataset . imgSrc1 = 'https://example.com/art.jpg' ;
586+ bigImgs . dataset . imgDesc1 = 'Some description' ;
587587 const introHeader = document . querySelector ( '.intro-header' ) ;
588588 introHeader . classList . add ( 'big-img' ) ;
589589 // Do NOT add .img-desc — covers the if(imgDesc) false branch
@@ -633,7 +633,7 @@ describe('game_detail.js', () => {
633633 test ( 'renders game without header h1 (pageHeaderH1 is null)' , ( ) => {
634634 // Remove .page-heading h1 from DOM
635635 const h1 = document . querySelector ( 'header.header-section .page-heading h1' ) ;
636- if ( h1 ) h1 . parentNode . removeChild ( h1 ) ;
636+ if ( h1 ) h1 . remove ( ) ;
637637 expect ( ( ) => renderGame ( { name : 'No Header Game' } ) ) . not . toThrow ( ) ;
638638 expect ( document . getElementById ( 'game-name' ) . textContent ) . toBe ( 'No Header Game' ) ;
639639 } ) ;
0 commit comments