Skip to content

Commit c1bccfe

Browse files
committed
Change Cookies Consent modal to trigger on astro:page-load event
1 parent 4309337 commit c1bccfe

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎src/components/Cookies/Consent/client.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { handleScriptError, addScriptBreadcrumb } from '@components/Scripts/erro
2424
*/
2525
export class CookieConsent extends LoadableScript {
2626
static override scriptName = 'CookieConsent'
27-
static override eventType: TriggerEvent = 'delayed'
27+
static override eventType: TriggerEvent = 'astro:page-load'
2828

2929
/** Modal wrapper element */
3030
wrapper: HTMLDivElement

‎src/components/Scripts/state/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export function initStateSideEffects(): void {
347347

348348
// Side Effect 6: Show/hide cookie modal
349349
$cookieModalVisible.subscribe(visible => {
350-
const modal = document.getElementById('cookie-consent-modal-id')
350+
const modal = document.getElementById('cookie-modal-id')
351351
if (modal) {
352352
modal.style.display = visible ? 'flex' : 'none'
353353
}

‎test/e2e/specs/01-smoke/critical-paths.spec.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,15 @@ test.describe('Critical Paths @smoke', () => {
9898
await expect(page.locator('button[aria-label="toggle theme switcher"]')).toBeVisible()
9999
})
100100

101-
test.skip('@ready cookie consent banner appears', async ({ page, context }) => {
102-
// FIXME: Cookie modal exists in DOM but is CSS hidden - appears to be an application bug
103-
// The modal doesn't show even after clearing cookies
101+
test('@ready cookie consent banner appears', async ({ page, context }) => {
104102
// Clear consent cookies to force banner to appear
105103
await clearConsentCookies(context)
106104

107105
await page.goto('/')
108106
await page.waitForLoadState('networkidle')
109107

110-
// Cookie modal should be visible (wait for animation/JS to show it)
111-
await expect(page.locator('#cookie-modal-id')).toBeVisible({ timeout: 10000 })
108+
// Cookie modal should be visible
109+
await expect(page.locator('#cookie-modal-id')).toBeVisible()
112110
})
113111

114112
test('@ready main pages have no 404 errors', async ({ page }) => {

0 commit comments

Comments
 (0)