@@ -27,6 +27,10 @@ const consentContent = {
2727 description : 'Manage your cookie preferences.' ,
2828 } ,
2929 intro : 'Intro content' ,
30+ introLinks : {
31+ privacyPolicyText : 'Privacy Policy' ,
32+ myDataText : 'My Data' ,
33+ } ,
3034 essential : {
3135 heading : 'Essential Data' ,
3236 subheading : 'Always active' ,
@@ -68,7 +72,7 @@ const consentContent = {
6872 questions : {
6973 heading : 'Questions' ,
7074 subheading : 'Questions subheading' ,
71- metods : [ ] ,
75+ methods : [ ] ,
7276 } ,
7377}
7478
@@ -352,18 +356,20 @@ describe('ConsentPreferencesElement', () => {
352356 const functionalCheckbox = window . document . getElementById (
353357 'functional-cookies'
354358 ) as HTMLInputElement | null
355- const contactLink = window . document . querySelector ( 'a[href="/contact/"]' ) as HTMLAnchorElement | null
359+ const contactLink = window . document . createElement ( 'a' )
360+ contactLink . href = '/contact/'
361+ contactLink . textContent = 'Contact'
362+ window . document . body . append ( contactLink )
356363 const dialog = window . document . getElementById ( 'consent-unsaved-dialog' ) as HTMLElement | null
357364
358365 expect ( functionalCheckbox ) . not . toBeNull ( )
359- expect ( contactLink ) . not . toBeNull ( )
360366 expect ( dialog ) . not . toBeNull ( )
361367
362368 functionalCheckbox ! . checked = true
363369 functionalCheckbox ! . dispatchEvent ( new window . Event ( 'change' , { bubbles : true } ) )
364370
365371 const navigationEvent = new window . MouseEvent ( 'click' , { bubbles : true , cancelable : true } )
366- contactLink ! . dispatchEvent ( navigationEvent )
372+ contactLink . dispatchEvent ( navigationEvent )
367373
368374 expect ( navigationEvent . defaultPrevented ) . toBe ( true )
369375 expect ( dialog ! . hasAttribute ( 'open' ) ) . toBe ( true )
@@ -375,19 +381,21 @@ describe('ConsentPreferencesElement', () => {
375381 const functionalCheckbox = window . document . getElementById (
376382 'functional-cookies'
377383 ) as HTMLInputElement | null
378- const contactLink = window . document . querySelector ( 'a[href="/contact/"]' ) as HTMLAnchorElement | null
384+ const contactLink = window . document . createElement ( 'a' )
385+ contactLink . href = '/contact/'
386+ contactLink . textContent = 'Contact'
387+ window . document . body . append ( contactLink )
379388 const discardBtn = window . document . getElementById ( 'consent-unsaved-discard' ) as HTMLButtonElement | null
380389 const dialog = window . document . getElementById ( 'consent-unsaved-dialog' ) as HTMLElement | null
381390
382391 expect ( functionalCheckbox ) . not . toBeNull ( )
383- expect ( contactLink ) . not . toBeNull ( )
384392 expect ( discardBtn ) . not . toBeNull ( )
385393 expect ( dialog ) . not . toBeNull ( )
386394
387395 functionalCheckbox ! . checked = true
388396 functionalCheckbox ! . dispatchEvent ( new window . Event ( 'change' , { bubbles : true } ) )
389397
390- contactLink ! . dispatchEvent ( new window . MouseEvent ( 'click' , { bubbles : true , cancelable : true } ) )
398+ contactLink . dispatchEvent ( new window . MouseEvent ( 'click' , { bubbles : true , cancelable : true } ) )
391399 expect ( dialog ! . hasAttribute ( 'open' ) ) . toBe ( true )
392400
393401 discardBtn ! . dispatchEvent ( new window . MouseEvent ( 'click' , { bubbles : true } ) )
0 commit comments