@@ -8,32 +8,17 @@ import {
88} from './onboarding-modal.js'
99
1010describe ( 'onboarding-modal' , ( ) => {
11- let originalMatchMedia
12-
1311 beforeEach ( ( ) => {
1412 localStorage . clear ( )
1513 i18n . init ( )
1614 // Note: innerHTML usage here is in test code only, not production.
1715 // The test DOM is reset between tests and contains no user input.
1816 document . body . innerHTML = ''
19- // Mock matchMedia - default to desktop (min-width: 640px matches)
20- originalMatchMedia = window . matchMedia
21- window . matchMedia = ( query ) => ( {
22- matches : query === '(min-width: 640px)' ,
23- media : query ,
24- onchange : null ,
25- addListener : ( ) => { } ,
26- removeListener : ( ) => { } ,
27- addEventListener : ( ) => { } ,
28- removeEventListener : ( ) => { } ,
29- dispatchEvent : ( ) => false ,
30- } )
3117 } )
3218
3319 afterEach ( ( ) => {
3420 document . body . innerHTML = ''
3521 document . body . style . overflow = ''
36- window . matchMedia = originalMatchMedia
3722 } )
3823
3924 describe ( 'shouldShowOnboarding' , ( ) => {
@@ -83,7 +68,7 @@ describe('onboarding-modal', () => {
8368 expect ( modal . textContent ) . toContain ( 'One word, and the AI gets the rest.' )
8469 } )
8570
86- it ( 'contains the YouTube embed for desktop ' , ( ) => {
71+ it ( 'contains the YouTube embed' , ( ) => {
8772 createOnboardingModal ( )
8873 showOnboarding ( )
8974
@@ -101,25 +86,13 @@ describe('onboarding-modal', () => {
10186 expect ( iframe . src ) . toContain ( 'youtube.com/embed/cp-qqiHU-MA' )
10287 } )
10388
104- it ( 'contains YouTube link on mobile instead of iframe' , ( ) => {
105- window . matchMedia = ( query ) => ( {
106- matches : false ,
107- media : query ,
108- onchange : null ,
109- addListener : ( ) => { } ,
110- removeListener : ( ) => { } ,
111- addEventListener : ( ) => { } ,
112- removeEventListener : ( ) => { } ,
113- dispatchEvent : ( ) => false ,
114- } )
89+ it ( 'always embeds video iframe regardless of screen size' , ( ) => {
11590 createOnboardingModal ( )
11691 showOnboarding ( )
11792
118- const link = document . querySelector ( '#onboarding-modal a[href*="youtube.com/shorts"]' )
119- expect ( link ) . toBeTruthy ( )
120- expect ( link . getAttribute ( 'target' ) ) . toBe ( '_blank' )
12193 const iframe = document . querySelector ( '#onboarding-modal iframe' )
122- expect ( iframe ) . toBeNull ( )
94+ expect ( iframe ) . toBeTruthy ( )
95+ expect ( iframe . src ) . toContain ( 'youtube.com/embed/' )
12396 } )
12497 } )
12598
0 commit comments