@abyss-project/commons-front-core 17.2.1 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -1
  3. package/catalog/captures-plan.ts +120 -116
  4. package/catalog/catalog-entries.ts +149 -148
  5. package/catalog/pages/AppShell.tsx +18 -9
  6. package/catalog/pages/CookieConsent.tsx +54 -31
  7. package/catalog/pages/DeliveryHistory.tsx +66 -66
  8. package/catalog/pages/DeliverySubscriptions.tsx +110 -110
  9. package/catalog/pages/ScheduledTasks.tsx +117 -117
  10. package/catalog/pages/index.ts +166 -165
  11. package/catalog/playwright.ci.config.ts +4 -3
  12. package/catalog/specs/captures.spec.ts +145 -145
  13. package/catalog/specs/cookie-consent-modal.spec.ts +187 -0
  14. package/catalog/specs/write-capture-index.ts +81 -81
  15. package/dist/CookieConsentSettings-B7HIIzyI.js +595 -0
  16. package/dist/{Surface-BDfRxVLj.js → Surface-dziv23sf.js} +56 -51
  17. package/dist/{Tabs-DEY2HEqj.js → Tabs-_onUZBA-.js} +613 -591
  18. package/dist/components/business/CookieConsent/AbyssCookieConsentProvider.d.ts +11 -3
  19. package/dist/components/business/CookieConsent/CookieConsentBanner.d.ts +4 -3
  20. package/dist/components/business/CookieConsent/CookieConsentPreferences.d.ts +12 -0
  21. package/dist/components/business/CookieConsent/index.d.ts +2 -0
  22. package/dist/components/business/CookieConsent/use-banner-portal.d.ts +36 -0
  23. package/dist/components/inputs/NumberField/NumberField.d.ts +18 -2
  24. package/dist/components/layers/Toast/toast-clearance.d.ts +5 -0
  25. package/dist/components/structure/AccountMenu/AccountMenu.d.ts +2 -1
  26. package/dist/components/structure/AppShell/SpaceSwitcher.d.ts +4 -2
  27. package/dist/components/structure/AppShell/app-shell.types.d.ts +5 -1
  28. package/dist/components/structure/FilterBar/FilterBar.d.ts +7 -2
  29. package/dist/cookie-consent.js +26 -17
  30. package/dist/{design-theme-Bd0pEPei.js → design-theme-B3C3z1gE.js} +1 -1
  31. package/dist/{editors-CtkDomwX.js → editors-BhQlONOy.js} +27 -27
  32. package/dist/editors.js +1 -1
  33. package/dist/hooks/use-cookie-consent.hook.spec.d.ts +1 -0
  34. package/dist/hooks/use-rich-intl.hook.d.ts +2 -0
  35. package/dist/{index-DKsvuaEj.js → index-B6LMTOKG.js} +3 -3
  36. package/dist/{index-B9avfa3r.js → index-B6w5_TeJ.js} +3 -3
  37. package/dist/{index-Ch8JqU5w.js → index-BBF-FvT6.js} +2 -2
  38. package/dist/{index-CqgMX8kF.js → index-BGAZK8Vk.js} +2 -2
  39. package/dist/{index-DnQguWf1.js → index-BGJobvxw.js} +1 -1
  40. package/dist/{index-SN7FZBya.js → index-BTDlbjWW.js} +2 -2
  41. package/dist/{index-Cl3hwdsZ.js → index-BcjlG5TB.js} +2 -2
  42. package/dist/{index-CSdO6zlX.js → index-BeMiREqf.js} +2 -2
  43. package/dist/{index-psJ1Q-lU.js → index-ByN6DcaL.js} +2 -2
  44. package/dist/{index-DtpGwH5a.js → index-CJI1dJrw.js} +3 -3
  45. package/dist/{index-CEjiERmo.js → index-D1mQgWN3.js} +2 -2
  46. package/dist/{index-BcXqvMY8.js → index-DLlWMDxB.js} +4 -4
  47. package/dist/{index-DFZlN4E3.js → index-DNd8NZnu.js} +4 -4
  48. package/dist/{index-mUtvzoSi.js → index-Dakpr4C1.js} +3 -3
  49. package/dist/{index-D0EF36wh.js → index-DkZAsKob.js} +2 -2
  50. package/dist/{index-FUuoLSZ0.js → index-DprTO7yi.js} +4 -4
  51. package/dist/{index-DZbCUZUp.js → index-N4BwXTyk.js} +2 -2
  52. package/dist/{index-IVjoNq-p.js → index-V4F4Sk7y.js} +2 -2
  53. package/dist/{index-DcV2fWbx.js → index-y-TnfE6Z.js} +2 -2
  54. package/dist/{index-DtncSsmw.js → index-yFJTDKIX.js} +2 -2
  55. package/dist/{index-DVBqUPxf.js → index-ytgNPz5f.js} +2 -2
  56. package/dist/index.js +3480 -3417
  57. package/dist/legacy.js +1728 -1707
  58. package/dist/translations/en.d.ts +1 -0
  59. package/dist/translations/fr.d.ts +1 -0
  60. package/dist/utils/cookie-consent-contract.d.ts +55 -0
  61. package/dist/utils/cookie-consent-contract.spec.d.ts +1 -0
  62. package/dist/utils/cookie-storage.utils.d.ts +1 -8
  63. package/dist/utils/index.d.ts +1 -0
  64. package/package.json +1 -1
  65. package/dist/CookieConsentSettings-CtLrSfve.js +0 -505
@@ -1,145 +1,145 @@
1
- import { resolve } from 'path';
2
- import { expect, test } from '@playwright/test';
3
- import type { Page } from '@playwright/test';
4
- import { CAPTURES, CAPTURES_DIR, VIEWPORT_HEIGHT } from '../captures-plan';
5
- import type { CaptureState } from '../captures-plan';
6
- import { openCatalogPage, settle } from './catalog-page';
7
-
8
- // Criterion 13: one PNG per component in light and dark at 1440 px, plus 390 px for the
9
- // components that change form below 768 px, and the two composed scenes at 1440 and 390 px.
10
-
11
- /** Opens the « Actions » menu of the first row of the page and picks the item named `item`. */
12
- const chooseRowAction = async (
13
- page: Page,
14
- item: string | RegExp,
15
- ): Promise<void> => {
16
- await page
17
- .getByRole('button', { name: /^Actions de / })
18
- .first()
19
- .click();
20
- await page.getByRole('menuitem', { name: item }).click();
21
- };
22
-
23
- /** How each state beyond arrival is reached, and what proves it is shown. */
24
- const REACH: Record<
25
- Exclude<CaptureState, 'arrival'>,
26
- (page: Page) => Promise<void>
27
- > = {
28
- 'sheet-open': async (page) => {
29
- await page
30
- .getByRole('button', { name: /avis-imposition-2026\.pdf/ })
31
- .click();
32
- await expect(
33
- page.getByRole('dialog', { name: 'avis-imposition-2026.pdf' }),
34
- ).toBeVisible();
35
- },
36
- 'list-open': async (page) => {
37
- await page.getByRole('combobox').first().click();
38
- await expect(page.getByRole('listbox')).toBeVisible();
39
- },
40
- 'calendar-open': async (page) => {
41
- await page
42
- .getByRole('button', { name: /Choisir une date/ })
43
- .first()
44
- .click();
45
- await expect(page.getByRole('dialog')).toBeVisible();
46
- },
47
- // The value of a list (six actions): the menu lists every action with its label.
48
- 'menu-open': async (page) => {
49
- await page.getByRole('button', { name: /Actions sur requestId/ }).click();
50
- const menu = page.getByRole('menu').or(page.getByRole('dialog'));
51
- await expect(menu).toBeVisible();
52
- await expect(menu.getByRole('menuitem')).toHaveCount(6);
53
- },
54
- // The delivery components: the first row's « Actions » menu, then the panel an action opens.
55
- 'form-open': async (page) => {
56
- await page
57
- .getByRole('button', { name: /^Nouvel(le)? (abonnement|tâche)$/ })
58
- .first()
59
- .click();
60
- await expect(
61
- page.getByRole('dialog', {
62
- name: /^Nouvel abonnement$|^Nouvelle tâche planifiée$/,
63
- }),
64
- ).toBeVisible();
65
- },
66
- 'secret-shown': async (page) => {
67
- await chooseRowAction(page, /Réinitialiser le secret|Régénérer le secret/);
68
- await page
69
- .getByRole('dialog')
70
- .getByRole('button', { name: /^(Réinitialiser|Régénérer)$/ })
71
- .click();
72
- await expect(
73
- page.getByText(/Ce secret n’est affiché qu’une seule fois/),
74
- ).toBeVisible();
75
- },
76
- 'delete-confirm': async (page) => {
77
- await chooseRowAction(page, 'Supprimer');
78
- await expect(
79
- page.getByRole('dialog', { name: /^Supprimer cet(te)? / }),
80
- ).toBeVisible();
81
- },
82
- 'detail-open': async (page) => {
83
- await chooseRowAction(page, 'Détail de la livraison');
84
- await expect(
85
- page.getByRole('dialog', { name: 'Détail de la livraison' }),
86
- ).toBeVisible();
87
- await expect(page.getByText('x-abyss-delivery-id').first()).toBeVisible();
88
- },
89
- 'runs-open': async (page) => {
90
- await chooseRowAction(page, 'Exécutions');
91
- await expect(
92
- page.getByRole('dialog', { name: /^Exécutions de / }),
93
- ).toBeVisible();
94
- await expect(page.getByText('Réussie').first()).toBeVisible();
95
- },
96
- // The cookie banner's settings: the banner leaves while the sheet is open.
97
- 'settings-open': async (page) => {
98
- await page.getByRole('button', { name: 'Personnaliser' }).click();
99
- await expect(
100
- page.getByRole('dialog', { name: 'Personnaliser mes cookies' }),
101
- ).toBeVisible();
102
- await expect(
103
- page.getByRole('dialog', { name: 'Vos préférences de cookies' }),
104
- ).toHaveCount(0);
105
- },
106
- // The first top bar trigger of the page: the notifications bell or the account avatar.
107
- 'panel-open': async (page) => {
108
- await page.locator('[aria-haspopup]').first().click();
109
- await expect(
110
- page.getByRole('dialog').or(page.getByRole('menu')),
111
- ).toBeVisible();
112
- },
113
- };
114
-
115
- for (const capture of CAPTURES) {
116
- test(`capture ${capture.file}`, async ({ page }) => {
117
- await openCatalogPage(page, capture.entry.name, capture.theme, {
118
- width: capture.width,
119
- height: VIEWPORT_HEIGHT[capture.width],
120
- });
121
-
122
- if (capture.state !== 'arrival') {
123
- await REACH[capture.state](page);
124
- await settle(page);
125
- }
126
-
127
- // A taller window rather than `fullPage`: the sticky sidebar (`100vh`) then spans the whole
128
- // page, as it does on screen while scrolling. A mobile frame (`100dvh`) is never taller.
129
- const documentHeight = await page.evaluate(
130
- () => document.documentElement.scrollHeight,
131
- );
132
- if (documentHeight > VIEWPORT_HEIGHT[capture.width]) {
133
- await page.setViewportSize({
134
- width: capture.width,
135
- height: documentHeight,
136
- });
137
- await settle(page);
138
- }
139
-
140
- await page.screenshot({
141
- path: resolve(CAPTURES_DIR, capture.file),
142
- animations: 'disabled',
143
- });
144
- });
145
- }
1
+ import { resolve } from 'path';
2
+ import { expect, test } from '@playwright/test';
3
+ import type { Page } from '@playwright/test';
4
+ import { CAPTURES, CAPTURES_DIR, VIEWPORT_HEIGHT } from '../captures-plan';
5
+ import type { CaptureState } from '../captures-plan';
6
+ import { openCatalogPage, settle } from './catalog-page';
7
+
8
+ // Criterion 13: one PNG per component in light and dark at 1440 px, plus 390 px for the
9
+ // components that change form below 768 px, and the two composed scenes at 1440 and 390 px.
10
+
11
+ /** Opens the « Actions » menu of the first row of the page and picks the item named `item`. */
12
+ const chooseRowAction = async (
13
+ page: Page,
14
+ item: string | RegExp,
15
+ ): Promise<void> => {
16
+ await page
17
+ .getByRole('button', { name: /^Actions de / })
18
+ .first()
19
+ .click();
20
+ await page.getByRole('menuitem', { name: item }).click();
21
+ };
22
+
23
+ /** How each state beyond arrival is reached, and what proves it is shown. */
24
+ const REACH: Record<
25
+ Exclude<CaptureState, 'arrival'>,
26
+ (page: Page) => Promise<void>
27
+ > = {
28
+ 'sheet-open': async (page) => {
29
+ await page
30
+ .getByRole('button', { name: /avis-imposition-2026\.pdf/ })
31
+ .click();
32
+ await expect(
33
+ page.getByRole('dialog', { name: 'avis-imposition-2026.pdf' }),
34
+ ).toBeVisible();
35
+ },
36
+ 'list-open': async (page) => {
37
+ await page.getByRole('combobox').first().click();
38
+ await expect(page.getByRole('listbox')).toBeVisible();
39
+ },
40
+ 'calendar-open': async (page) => {
41
+ await page
42
+ .getByRole('button', { name: /Choisir une date/ })
43
+ .first()
44
+ .click();
45
+ await expect(page.getByRole('dialog')).toBeVisible();
46
+ },
47
+ // The value of a list (six actions): the menu lists every action with its label.
48
+ 'menu-open': async (page) => {
49
+ await page.getByRole('button', { name: /Actions sur requestId/ }).click();
50
+ const menu = page.getByRole('menu').or(page.getByRole('dialog'));
51
+ await expect(menu).toBeVisible();
52
+ await expect(menu.getByRole('menuitem')).toHaveCount(6);
53
+ },
54
+ // The delivery components: the first row's « Actions » menu, then the panel an action opens.
55
+ 'form-open': async (page) => {
56
+ await page
57
+ .getByRole('button', { name: /^Nouvel(le)? (abonnement|tâche)$/ })
58
+ .first()
59
+ .click();
60
+ await expect(
61
+ page.getByRole('dialog', {
62
+ name: /^Nouvel abonnement$|^Nouvelle tâche planifiée$/,
63
+ }),
64
+ ).toBeVisible();
65
+ },
66
+ 'secret-shown': async (page) => {
67
+ await chooseRowAction(page, /Réinitialiser le secret|Régénérer le secret/);
68
+ await page
69
+ .getByRole('dialog')
70
+ .getByRole('button', { name: /^(Réinitialiser|Régénérer)$/ })
71
+ .click();
72
+ await expect(
73
+ page.getByText(/Ce secret n’est affiché qu’une seule fois/),
74
+ ).toBeVisible();
75
+ },
76
+ 'delete-confirm': async (page) => {
77
+ await chooseRowAction(page, 'Supprimer');
78
+ await expect(
79
+ page.getByRole('dialog', { name: /^Supprimer cet(te)? / }),
80
+ ).toBeVisible();
81
+ },
82
+ 'detail-open': async (page) => {
83
+ await chooseRowAction(page, 'Détail de la livraison');
84
+ await expect(
85
+ page.getByRole('dialog', { name: 'Détail de la livraison' }),
86
+ ).toBeVisible();
87
+ await expect(page.getByText('x-abyss-delivery-id').first()).toBeVisible();
88
+ },
89
+ 'runs-open': async (page) => {
90
+ await chooseRowAction(page, 'Exécutions');
91
+ await expect(
92
+ page.getByRole('dialog', { name: /^Exécutions de / }),
93
+ ).toBeVisible();
94
+ await expect(page.getByText('Réussie').first()).toBeVisible();
95
+ },
96
+ // The cookie banner's settings: the banner leaves while the sheet is open.
97
+ 'settings-open': async (page) => {
98
+ await page.getByRole('button', { name: 'Personnaliser' }).click();
99
+ await expect(
100
+ page.getByRole('dialog', { name: 'Personnaliser mes cookies' }),
101
+ ).toBeVisible();
102
+ await expect(
103
+ page.getByRole('dialog', { name: 'Vos préférences de cookies' }),
104
+ ).toHaveCount(0);
105
+ },
106
+ // The first top bar trigger of the page: the notifications bell or the account avatar.
107
+ 'panel-open': async (page) => {
108
+ await page.locator('[aria-haspopup]').first().click();
109
+ await expect(
110
+ page.getByRole('dialog').or(page.getByRole('menu')),
111
+ ).toBeVisible();
112
+ },
113
+ };
114
+
115
+ for (const capture of CAPTURES) {
116
+ test(`capture ${capture.file}`, async ({ page }) => {
117
+ await openCatalogPage(page, capture.entry.name, capture.theme, {
118
+ width: capture.width,
119
+ height: VIEWPORT_HEIGHT[capture.width],
120
+ });
121
+
122
+ if (capture.state !== 'arrival') {
123
+ await REACH[capture.state](page);
124
+ await settle(page);
125
+ }
126
+
127
+ // A taller window rather than `fullPage`: the sticky sidebar (`100vh`) then spans the whole
128
+ // page, as it does on screen while scrolling. A mobile frame (`100dvh`) is never taller.
129
+ const documentHeight = await page.evaluate(
130
+ () => document.documentElement.scrollHeight,
131
+ );
132
+ if (documentHeight > VIEWPORT_HEIGHT[capture.width]) {
133
+ await page.setViewportSize({
134
+ width: capture.width,
135
+ height: documentHeight,
136
+ });
137
+ await settle(page);
138
+ }
139
+
140
+ await page.screenshot({
141
+ path: resolve(CAPTURES_DIR, capture.file),
142
+ animations: 'disabled',
143
+ });
144
+ });
145
+ }
@@ -0,0 +1,187 @@
1
+ import { expect, test } from '@playwright/test';
2
+ import type { Page } from '@playwright/test';
3
+ import { ThemeMode } from '../../src/theme/tokens/primitives';
4
+ import { openCatalogPage, settle } from './catalog-page';
5
+
6
+ // #747: while a modal, a wizard or a drawer is open, the cookie banner is not `aria-hidden` (what
7
+ // MUI puts on the other children of `body`: the banner was in the page, not in the modal) and does
8
+ // not cover the modal's main action. jsdom has no layout and no accessibility tree: this is read
9
+ // from Chromium itself, through the DevTools protocol. It does NOT prove the placement in the
10
+ // `aria-modal` surface: Chromium keeps what is outside that surface in its tree, so a banner put
11
+ // elsewhere in the modal passes too. That placement is proved by CookieConsent.spec.tsx.
12
+
13
+ const BANNER_BUTTON = 'Tout accepter';
14
+
15
+ /** Whether Chromium's accessibility tree holds a button of that name that is not ignored (not aria-hidden). */
16
+ const inAccessibilityTree = async (
17
+ page: Page,
18
+ buttonName: string,
19
+ ): Promise<boolean> => {
20
+ const cdp = await page.context().newCDPSession(page);
21
+ await cdp.send('Accessibility.enable');
22
+ const { nodes } = await cdp.send('Accessibility.getFullAXTree');
23
+ await cdp.detach();
24
+ return nodes.some(
25
+ (node) =>
26
+ node.role?.value === 'button' &&
27
+ node.name?.value === buttonName &&
28
+ node.ignored !== true,
29
+ );
30
+ };
31
+
32
+ const boxOf = async (page: Page, name: string) => {
33
+ const box = await page
34
+ .getByRole('button', { name, exact: true })
35
+ .boundingBox();
36
+ if (box === null) {
37
+ throw new Error(`The button « ${name} » has no box.`);
38
+ }
39
+ return box;
40
+ };
41
+
42
+ const overlaps = (
43
+ a: { x: number; y: number; width: number; height: number },
44
+ b: { x: number; y: number; width: number; height: number },
45
+ ): boolean =>
46
+ a.x < b.x + b.width &&
47
+ b.x < a.x + a.width &&
48
+ a.y < b.y + b.height &&
49
+ b.y < a.y + a.height;
50
+
51
+ const VIEWPORTS = [
52
+ { label: 'dialog', width: 1440, height: 900 },
53
+ { label: 'bottom sheet', width: 390, height: 844 },
54
+ ] as const;
55
+
56
+ for (const viewport of VIEWPORTS) {
57
+ test(`the banner is not aria-hidden and clear of « Suivant » over a ${viewport.label}`, async ({
58
+ page,
59
+ }) => {
60
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, viewport);
61
+ expect(await inAccessibilityTree(page, BANNER_BUTTON)).toBe(true);
62
+
63
+ await page.getByRole('button', { name: "Ouvrir l'assistant" }).click();
64
+ await expect(
65
+ page.getByRole('dialog', { name: 'Assistant de démarrage' }),
66
+ ).toBeVisible();
67
+ await settle(page);
68
+
69
+ expect(await inAccessibilityTree(page, BANNER_BUTTON)).toBe(true);
70
+ await expect(
71
+ page.getByRole('button', { name: BANNER_BUTTON }),
72
+ ).toBeVisible();
73
+
74
+ const next = await boxOf(page, 'Suivant');
75
+ const banner = await page
76
+ .getByRole('dialog', { name: 'Vos préférences de cookies' })
77
+ .boundingBox();
78
+ expect(banner).not.toBeNull();
79
+ expect(overlaps(next, banner!)).toBe(false);
80
+ // The browser agrees: what is at the middle of « Suivant » is « Suivant ».
81
+ const hit = await page.evaluate(
82
+ ({ x, y }) => document.elementFromPoint(x, y)?.textContent ?? '',
83
+ { x: next.x + next.width / 2, y: next.y + next.height / 2 },
84
+ );
85
+ expect(hit).toContain('Suivant');
86
+ });
87
+ }
88
+
89
+ test('the banner is not aria-hidden over a drawer and the drawer stops above it', async ({
90
+ page,
91
+ }) => {
92
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, {
93
+ width: 1440,
94
+ height: 900,
95
+ });
96
+ await page.getByRole('button', { name: "Ouvrir l'aperçu" }).click();
97
+ await expect(page.getByRole('dialog', { name: 'Aperçu' })).toBeVisible();
98
+ await settle(page);
99
+
100
+ expect(await inAccessibilityTree(page, BANNER_BUTTON)).toBe(true);
101
+ const drawer = await page
102
+ .getByRole('dialog', { name: 'Aperçu' })
103
+ .boundingBox();
104
+ const banner = await page
105
+ .getByRole('dialog', { name: 'Vos préférences de cookies' })
106
+ .boundingBox();
107
+ expect(drawer).not.toBeNull();
108
+ expect(banner).not.toBeNull();
109
+ expect(overlaps(drawer!, banner!)).toBe(false);
110
+ });
111
+
112
+ test('the banner comes back to the page, not aria-hidden, when the modal closes', async ({
113
+ page,
114
+ }) => {
115
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Light, {
116
+ width: 1440,
117
+ height: 900,
118
+ });
119
+ await page.getByRole('button', { name: "Ouvrir l'assistant" }).click();
120
+ await page.getByRole('button', { name: 'Suivant' }).click();
121
+ await expect(
122
+ page.getByRole('dialog', { name: 'Assistant de démarrage' }),
123
+ ).toHaveCount(0);
124
+ await settle(page);
125
+ expect(await inAccessibilityTree(page, BANNER_BUTTON)).toBe(true);
126
+ });
127
+
128
+ // The modal's root stops above the banner, but its scrim stays the whole screen: the margin the
129
+ // banner sits in is dimmed like the rest, and nothing of the page behind is reachable through it.
130
+ const SCRIMS = [
131
+ { label: 'dialog', width: 1440, height: 900, opener: "Ouvrir l'assistant" },
132
+ {
133
+ label: 'bottom sheet',
134
+ width: 390,
135
+ height: 844,
136
+ opener: "Ouvrir l'assistant",
137
+ },
138
+ { label: 'drawer', width: 1440, height: 900, opener: "Ouvrir l'aperçu" },
139
+ ] as const;
140
+
141
+ for (const scrim of SCRIMS) {
142
+ test(`the scrim covers the margin around the banner over a ${scrim.label}: the page is not reachable`, async ({
143
+ page,
144
+ }) => {
145
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, {
146
+ width: scrim.width,
147
+ height: scrim.height,
148
+ });
149
+ await page.getByRole('button', { name: scrim.opener }).click();
150
+ await settle(page);
151
+
152
+ // Points in the gutters of the banner and under its bottom edge: what is there is the scrim.
153
+ const points = [
154
+ { x: 3, y: scrim.height - 100 },
155
+ { x: scrim.width - 3, y: scrim.height - 100 },
156
+ { x: scrim.width / 2, y: scrim.height - 3 },
157
+ ];
158
+ const hits = await page.evaluate(
159
+ (probe) =>
160
+ probe.map(({ x, y }) => {
161
+ const element = document.elementFromPoint(x, y);
162
+ return {
163
+ inPage: document.getElementById('root')?.contains(element) ?? true,
164
+ isScrim: element?.classList.contains('MuiBackdrop-root') ?? false,
165
+ };
166
+ }),
167
+ points,
168
+ );
169
+ for (const hit of hits) {
170
+ expect(hit).toEqual({ inPage: false, isScrim: true });
171
+ }
172
+
173
+ // A click there reaches nothing of the page behind.
174
+ await page.evaluate(() => {
175
+ (window as unknown as { pageClicks: number }).pageClicks = 0;
176
+ document.getElementById('root')?.addEventListener('click', () => {
177
+ (window as unknown as { pageClicks: number }).pageClicks += 1;
178
+ });
179
+ });
180
+ await page.mouse.click(points[0].x, points[0].y);
181
+ expect(
182
+ await page.evaluate(
183
+ () => (window as unknown as { pageClicks: number }).pageClicks,
184
+ ),
185
+ ).toBe(0);
186
+ });
187
+ }
@@ -1,81 +1,81 @@
1
- import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
- import { resolve } from 'path';
3
- import { CAPTURES, CAPTURES_DIR } from '../captures-plan';
4
- import type { Capture, CaptureState } from '../captures-plan';
5
- import type { CatalogFamily } from '../catalog-entries';
6
-
7
- // Global teardown of the catalog run: writes `index.md` next to the screenshots, from the capture
8
- // plan, listing only the files present on disk.
9
-
10
- const FAMILY_TITLES: Record<CatalogFamily, string> = {
11
- scenes: 'Scènes composées (à regarder en premier)',
12
- structure: 'Structure',
13
- mobile: 'Mobile',
14
- states: 'États',
15
- data: 'Données',
16
- meaning: 'Sens',
17
- business: 'Métier',
18
- layers: 'Couches',
19
- navigation: 'Navigation',
20
- inputs: 'Saisie',
21
- };
22
-
23
- const STATE_LABEL: Record<CaptureState, string> = {
24
- arrival: '',
25
- 'sheet-open': ', feuille ouverte',
26
- 'list-open': ', liste ouverte',
27
- 'calendar-open': ', calendrier ouvert',
28
- 'panel-open': ', panneau ouvert',
29
- 'menu-open': ', menu ouvert',
30
- 'settings-open': ', réglages ouverts',
31
- 'form-open': ', formulaire ouvert',
32
- 'secret-shown': ', secret affiché une fois',
33
- 'delete-confirm': ', confirmation de suppression',
34
- 'detail-open': ', détail ouvert',
35
- 'runs-open': ', exécutions ouvertes',
36
- };
37
-
38
- const describe = (capture: Capture): string =>
39
- `${capture.theme === 'dark' ? 'sombre' : 'clair'}, ${capture.width} px${
40
- STATE_LABEL[capture.state]
41
- }`;
42
-
43
- const writeCaptureIndex = (): void => {
44
- mkdirSync(CAPTURES_DIR, { recursive: true });
45
- const present = CAPTURES.filter((capture) =>
46
- existsSync(resolve(CAPTURES_DIR, capture.file)),
47
- );
48
- const families = Object.keys(FAMILY_TITLES) as CatalogFamily[];
49
- const sections = families
50
- .map((family) => {
51
- const lines = present
52
- .filter((capture) => capture.entry.family === family)
53
- .map(
54
- (capture) =>
55
- `- \`${capture.file}\` : ${capture.entry.name}, ${describe(
56
- capture,
57
- )}`,
58
- );
59
- return lines.length === 0
60
- ? ''
61
- : `## ${FAMILY_TITLES[family]}\n\n${lines.join('\n')}\n`;
62
- })
63
- .filter((section) => section !== '');
64
- const missing = CAPTURES.length - present.length;
65
- const content = [
66
- '# Captures du catalogue du core (#286)',
67
- '',
68
- 'Produites par `pnpm --filter @abyss-project/commons-front-core catalog:test` (`catalog/specs/captures.spec.ts`).',
69
- 'Chaque composant en clair et en sombre à 1440 px ; à 390 px aussi ceux qui changent de forme sous 768 px ;',
70
- 'le shell et la scène bureau aussi à 768 px (rail d’icônes).',
71
- '',
72
- `${present.length} fichiers${
73
- missing > 0 ? `, ${missing} manquants (lancement partiel)` : ''
74
- }.`,
75
- '',
76
- ...sections,
77
- ].join('\n');
78
- writeFileSync(resolve(CAPTURES_DIR, 'index.md'), content);
79
- };
80
-
81
- export default writeCaptureIndex;
1
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
+ import { resolve } from 'path';
3
+ import { CAPTURES, CAPTURES_DIR } from '../captures-plan';
4
+ import type { Capture, CaptureState } from '../captures-plan';
5
+ import type { CatalogFamily } from '../catalog-entries';
6
+
7
+ // Global teardown of the catalog run: writes `index.md` next to the screenshots, from the capture
8
+ // plan, listing only the files present on disk.
9
+
10
+ const FAMILY_TITLES: Record<CatalogFamily, string> = {
11
+ scenes: 'Scènes composées (à regarder en premier)',
12
+ structure: 'Structure',
13
+ mobile: 'Mobile',
14
+ states: 'États',
15
+ data: 'Données',
16
+ meaning: 'Sens',
17
+ business: 'Métier',
18
+ layers: 'Couches',
19
+ navigation: 'Navigation',
20
+ inputs: 'Saisie',
21
+ };
22
+
23
+ const STATE_LABEL: Record<CaptureState, string> = {
24
+ arrival: '',
25
+ 'sheet-open': ', feuille ouverte',
26
+ 'list-open': ', liste ouverte',
27
+ 'calendar-open': ', calendrier ouvert',
28
+ 'panel-open': ', panneau ouvert',
29
+ 'menu-open': ', menu ouvert',
30
+ 'settings-open': ', réglages ouverts',
31
+ 'form-open': ', formulaire ouvert',
32
+ 'secret-shown': ', secret affiché une fois',
33
+ 'delete-confirm': ', confirmation de suppression',
34
+ 'detail-open': ', détail ouvert',
35
+ 'runs-open': ', exécutions ouvertes',
36
+ };
37
+
38
+ const describe = (capture: Capture): string =>
39
+ `${capture.theme === 'dark' ? 'sombre' : 'clair'}, ${capture.width} px${
40
+ STATE_LABEL[capture.state]
41
+ }`;
42
+
43
+ const writeCaptureIndex = (): void => {
44
+ mkdirSync(CAPTURES_DIR, { recursive: true });
45
+ const present = CAPTURES.filter((capture) =>
46
+ existsSync(resolve(CAPTURES_DIR, capture.file)),
47
+ );
48
+ const families = Object.keys(FAMILY_TITLES) as CatalogFamily[];
49
+ const sections = families
50
+ .map((family) => {
51
+ const lines = present
52
+ .filter((capture) => capture.entry.family === family)
53
+ .map(
54
+ (capture) =>
55
+ `- \`${capture.file}\` : ${capture.entry.name}, ${describe(
56
+ capture,
57
+ )}`,
58
+ );
59
+ return lines.length === 0
60
+ ? ''
61
+ : `## ${FAMILY_TITLES[family]}\n\n${lines.join('\n')}\n`;
62
+ })
63
+ .filter((section) => section !== '');
64
+ const missing = CAPTURES.length - present.length;
65
+ const content = [
66
+ '# Captures du catalogue du core (#286)',
67
+ '',
68
+ 'Produites par `pnpm --filter @abyss-project/commons-front-core catalog:test` (`catalog/specs/captures.spec.ts`).',
69
+ 'Chaque composant en clair et en sombre à 1440 px ; à 390 px aussi ceux qui changent de forme sous 768 px ;',
70
+ 'le shell et la scène bureau aussi à 768 px (rail d’icônes).',
71
+ '',
72
+ `${present.length} fichiers${
73
+ missing > 0 ? `, ${missing} manquants (lancement partiel)` : ''
74
+ }.`,
75
+ '',
76
+ ...sections,
77
+ ].join('\n');
78
+ writeFileSync(resolve(CAPTURES_DIR, 'index.md'), content);
79
+ };
80
+
81
+ export default writeCaptureIndex;