Skip to content

Commit 26ed7ea

Browse files
committed
Update 04-components E2E tests to pass on chromium
1 parent 8d8223f commit 26ed7ea

20 files changed

Lines changed: 172 additions & 94 deletions

File tree

‎.github/instructions/general.instructions.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ applyTo: "**"
3535
- **API utility files** go specifically in the `_utils/` folder
3636
- **API contract/type files** go in `_contracts/` folder for centralized type definitions
3737

38+
## API Endpoints (Permission Required)
39+
- **Do not create, recreate, or restore `src/pages/api/*` endpoints without explicit user permission.**
40+
- Prefer Astro Actions (`/_actions/...`) for new backend behavior unless instructed otherwise.
41+
3842
## Mixed Concern Files
3943
- Files that straddle server-side API and client-side concerns (like API client wrappers) require clarification
4044
- **Ask before placing such files** - they may need special handling or alternative organization

‎src/actions/gdpr/@types/index.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface ConsentRecord {
2727
id: string
2828
DataSubjectId: string
2929
email?: string
30-
purposes: Array<'contact' | 'marketing' | 'analytics' | 'downloads'>
30+
purposes: Array<'contact' | 'marketing' | 'analytics' | 'functional' | 'downloads'>
3131
timestamp: string
3232
source:
3333
| 'contact_form'
@@ -45,7 +45,7 @@ export interface ConsentRecord {
4545
export interface ConsentRequest {
4646
DataSubjectId: string
4747
email?: string
48-
purposes: Array<'contact' | 'marketing' | 'analytics' | 'downloads'>
48+
purposes: Array<'contact' | 'marketing' | 'analytics' | 'functional' | 'downloads'>
4949
source: string
5050
userAgent: string
5151
ipAddress?: string

‎src/actions/gdpr/constants.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const CONSENT_PURPOSES = ['contact', 'marketing', 'analytics', 'downloads'] as const
1+
export const CONSENT_PURPOSES = ['contact', 'marketing', 'analytics', 'functional', 'downloads'] as const
22

33
export type ConsentPurpose = (typeof CONSENT_PURPOSES)[number]
44

‎src/components/Consent/Banner/client/index.ts‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,6 @@ export class ConsentBannerElement extends HTMLElement {
168168
this.wrapper.style.display = 'block'
169169
this.setupFocusTrap()
170170
this.wrapper.focus()
171-
setTimeout(() => {
172-
if (this.wrapper.style.display === 'none') {
173-
return
174-
}
175-
176-
this.allowBtn.focus()
177-
}, 0)
178171
showConsentBanner()
179172
ConsentBannerElement.isModalCurrentlyVisible = true
180173
} catch (error) {
@@ -330,6 +323,17 @@ export class ConsentBannerElement extends HTMLElement {
330323
return
331324
}
332325

326+
if (document.activeElement === this.wrapper) {
327+
keyEvent.preventDefault()
328+
if (keyEvent.shiftKey) {
329+
lastFocusable.focus()
330+
return
331+
}
332+
333+
firstFocusable.focus()
334+
return
335+
}
336+
333337
if (keyEvent.shiftKey) {
334338
if (document.activeElement === firstFocusable) {
335339
keyEvent.preventDefault()

‎src/components/Consent/Preferences/index.astro‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ import logoSvg from '@assets/images/site/logo.svg'
7575
Helps us understand how visitors use our website
7676
</p>
7777
</div>
78-
<label class="relative inline-flex items-center cursor-pointer">
78+
<label
79+
class="relative inline-flex items-center cursor-pointer"
80+
data-consent-toggle="analytics-cookies"
81+
>
7982
<input
8083
type="checkbox"
8184
id="analytics-cookies"
@@ -117,7 +120,10 @@ import logoSvg from '@assets/images/site/logo.svg'
117120
Remembers your social media preferences
118121
</p>
119122
</div>
120-
<label class="relative inline-flex items-center cursor-pointer">
123+
<label
124+
class="relative inline-flex items-center cursor-pointer"
125+
data-consent-toggle="functional-cookies"
126+
>
121127
<input
122128
type="checkbox"
123129
id="functional-cookies"
@@ -165,7 +171,10 @@ import logoSvg from '@assets/images/site/logo.svg'
165171
Used to deliver relevant advertisements
166172
</p>
167173
</div>
168-
<label class="relative inline-flex items-center cursor-pointer">
174+
<label
175+
class="relative inline-flex items-center cursor-pointer"
176+
data-consent-toggle="marketing-cookies"
177+
>
169178
<input
170179
type="checkbox"
171180
id="marketing-cookies"

‎src/components/Icon/index.astro‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@ export interface Props {
1414
size?: number | string
1515
/** Color variant for the icon */
1616
variant?: IconVariant
17+
/** Optional accessible title for the rendered SVG */
18+
title?: string
1719
}
1820
19-
const { class: className, name, size = 24, variant = 'default' as IconVariant } = Astro.props
21+
const { class: className, name, size = 24, variant = 'default' as IconVariant, title } = Astro.props
22+
23+
const a11yProps = title
24+
? { title, 'aria-label': title }
25+
: { 'aria-hidden': 'true' as const }
2026
---
2127

2228
<Icon
2329
name={name}
2430
class:list={['inline-block align-middle', colorClasses[variant], `icon--${name}`, className]}
2531
size={size}
26-
aria-hidden="true"
32+
{...a11yProps}
2733
focusable="false"
2834
/>

‎src/components/Navigation/Menu.astro‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const activeMenuItem = (url: string) => {
2424
'w-full font-heading text-[0.85rem] uppercase tracking-[0.22em] text-primary',
2525
'lg:relative lg:text-[0.8rem] lg:tracking-[0.12em]',
2626
]}
27+
aria-label="main navigation"
2728
tabindex="-1"
2829
>
2930
{

‎src/components/Navigation/NavToggle.astro‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import styles from './navToggle.module.css'
66
---
77

88
<button
9+
id="nav-toggle"
10+
data-testid="nav-toggle"
911
class:list={[
1012
'nav-toggle-btn',
1113
'lg:hidden inline-flex items-center justify-center rounded-full border-0 bg-primary-offset text-bg transition-colors duration-150 ease-linear hover:bg-primary focus:bg-primary focus:outline-none',

‎src/components/Navigation/index.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const { path } = Astro.props
1717
<Menu path={path} />
1818
</span>
1919
{/* Mobile navigation toggle button to show menu on full-page splash screen */}
20-
<span id="header__nav-icon" class="block shrink-0 z-(--z-content-overlay) lg:hidden">
20+
<span id="header__nav-icon" class="block shrink-0 relative z-(--z-mobile-close-btn) lg:hidden">
2121
<NavToggle />
2222
</span>
2323
</div>

‎src/components/scripts/store/__tests__/consent.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ describe('Consent side effects', () => {
358358
throw new TestError('Expected consent logging fetch to be called once')
359359
}
360360
const [url, options] = firstFetchCall
361-
expect(url).toBe('/api/gdpr/consent')
361+
expect(url).toBe('/_actions/gdpr.consentCreate')
362362
expect(options?.method).toBe('POST')
363363
const payload = JSON.parse(options?.body as string)
364364
expect(payload).toMatchObject({

0 commit comments

Comments
 (0)