Skip to content

Commit f4f17b4

Browse files
committed
Check that implied can still be set
1 parent e1d58ed commit f4f17b4

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
**/*.quarto_ipynb
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Algolia With Cookie Consent Test"
6+
search:
7+
algolia:
8+
application-id: "TEST_APP_ID"
9+
search-only-api-key: "TEST_API_KEY"
10+
index-name: "test-index"
11+
analytics-events: true
12+
cookie-consent:
13+
type: implied
14+
15+
format:
16+
html:
17+
theme: cosmo
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "Algolia Search With Cookie Consent"
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
-
8+
# Ensure search options script exists
9+
- 'script#quarto-search-options'
10+
# Cookie consent element are loaded
11+
- script[src$='cookie-consent.js']
12+
ensureFileRegexMatches:
13+
-
14+
# Cookie consent should be enabled
15+
- '"cookie-consent-enabled":\s*true'
16+
# Scripts should be deferred with cookie-consent attribute
17+
- 'type="text/plain"[^>]*cookie-consent="tracking"[^>]*>[\s\S]*search-insights'
18+
# type should be implied per config
19+
- 'cookieconsent.run\(\{[^}]*"consent_type":"implied"'
20+
---
21+
22+
This test verifies that when `cookie-consent` is configured in the website settings:
23+
24+
1. The Algolia search options JSON contains `"cookie-consent-enabled": true`
25+
2. Algolia Insights scripts are deferred with `type="text/plain" cookie-consent="tracking"`
26+
3. Scripts only execute after user grants "tracking" consent
27+
4. Cookie consent UI elements are present on the page

0 commit comments

Comments
 (0)