@remit/ui 0.0.222 → 0.0.223

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 (200) hide show
  1. package/package.json +12 -3
  2. package/src/components/DropdownMenu.tsx +100 -0
  3. package/src/components/EmptyState.tsx +11 -0
  4. package/src/components/ErrorBanner.render.test.ts +107 -0
  5. package/src/components/ErrorBanner.stories.tsx +132 -0
  6. package/src/components/ErrorBanner.tsx +122 -0
  7. package/src/components/ErrorBannerStack.tsx +34 -0
  8. package/src/components/ErrorState.render.test.ts +82 -0
  9. package/src/components/ErrorState.tsx +80 -0
  10. package/src/components/KeyboardShortcutsModal.tsx +111 -0
  11. package/src/components/account-service-change-dialog.render.test.ts +1 -41
  12. package/src/components/account-service-choice.render.test.ts +0 -26
  13. package/src/components/account-service-toggles.render.test.ts +0 -6
  14. package/src/components/address-display.render.test.ts +1 -38
  15. package/src/components/address-tag.render.test.ts +0 -11
  16. package/src/components/agenda-flow.reach.test.ts +0 -8
  17. package/src/components/agenda-flow.render.test.ts +0 -31
  18. package/src/components/agenda-panels.render.test.ts +0 -5
  19. package/src/components/app-shell-slotted.render.test.ts +0 -118
  20. package/src/components/attachment-list.render.test.ts +41 -24
  21. package/src/components/attachment-list.stories.tsx +67 -0
  22. package/src/components/attachment-list.tsx +112 -35
  23. package/src/components/attendee-row.render.test.ts +0 -41
  24. package/src/components/attention-dot.stories.tsx +46 -0
  25. package/src/components/attention-dot.tsx +23 -0
  26. package/src/components/banner.render.test.ts +0 -7
  27. package/src/components/bottom-sheet.render.test.ts +0 -42
  28. package/src/components/brief-section.render.test.ts +0 -13
  29. package/src/components/brief-sections.keyboard.test.ts +0 -13
  30. package/src/components/brief-sections.render.test.ts +0 -22
  31. package/src/components/calendar-clash-strip.render.test.ts +0 -19
  32. package/src/components/calendar-grid.render.test.ts +0 -79
  33. package/src/components/calendar-invite-card.render.test.ts +0 -19
  34. package/src/components/calendar-list.render.test.ts +0 -21
  35. package/src/components/calendar-slot-offers.render.test.ts +0 -24
  36. package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
  37. package/src/components/calendar-toolbar.render.test.ts +1 -53
  38. package/src/components/category-badge.render.test.ts +1 -24
  39. package/src/components/compose-action-bar.render.test.ts +0 -5
  40. package/src/components/compose-attachments.render.test.ts +0 -38
  41. package/src/components/event-detail.render.test.ts +0 -27
  42. package/src/components/event-editor.render.test.ts +0 -4
  43. package/src/components/event-suggestion-card.render.test.ts +0 -61
  44. package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
  45. package/src/components/filter-clause-chip.tsx +1 -60
  46. package/src/components/filter-rule-editor.create.test.ts +0 -6
  47. package/src/components/filter-rule-editor.stories.tsx +24 -138
  48. package/src/components/filter-rule-editor.tsx +7 -93
  49. package/src/components/filter-rule.render.test.ts +9 -299
  50. package/src/components/filter-rule.ts +20 -85
  51. package/src/components/filter-sheet.render.test.ts +0 -7
  52. package/src/components/folder-manage-actions.render.test.ts +0 -13
  53. package/src/components/folder-manager.render.test.ts +0 -31
  54. package/src/components/folder-mutation-dialog.render.test.ts +0 -83
  55. package/src/components/folder-rename-dialog.render.test.ts +0 -14
  56. package/src/components/folder-row.render.test.ts +0 -30
  57. package/src/components/folder-sync-state.test.ts +0 -61
  58. package/src/components/folder-tree-picker.create.test.ts +0 -30
  59. package/src/components/folder-tree-picker.render.test.ts +0 -35
  60. package/src/components/intelligence-calendar-fixtures.ts +0 -2
  61. package/src/components/intelligence-calendar.render.test.ts +0 -4
  62. package/src/components/intelligence-panel.render.test.ts +1 -62
  63. package/src/components/intelligence-panel.stories.tsx +0 -76
  64. package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
  65. package/src/components/intelligence-panel.tsx +6 -176
  66. package/src/components/intelligence-toggle.render.test.ts +0 -5
  67. package/src/components/isolated-email-frame.render.test.ts +0 -122
  68. package/src/components/isolated-email-frame.tsx +1 -1
  69. package/src/components/keyboard-hint-bar.render.test.ts +0 -7
  70. package/src/components/label-chip.render.test.ts +0 -28
  71. package/src/components/label-chip.tsx +1 -1
  72. package/src/components/mail-header.render.test.ts +0 -20
  73. package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
  74. package/src/components/mcp-connected-apps-page.tsx +79 -0
  75. package/src/components/mcp-consent-page.stories.tsx +39 -0
  76. package/src/components/mcp-consent-page.tsx +47 -0
  77. package/src/components/mcp-device-page.stories.tsx +57 -0
  78. package/src/components/mcp-device-page.tsx +107 -0
  79. package/src/components/mcp-error-notice.stories.tsx +34 -0
  80. package/src/components/mcp-error-notice.tsx +23 -0
  81. package/src/components/mcp-error-page.stories.tsx +17 -0
  82. package/src/components/mcp-error-page.tsx +15 -0
  83. package/src/components/mcp-fixtures.ts +16 -0
  84. package/src/components/mcp-login-page.stories.tsx +37 -0
  85. package/src/components/mcp-login-page.tsx +58 -0
  86. package/src/components/mcp-page.stories.tsx +27 -0
  87. package/src/components/mcp-page.tsx +35 -0
  88. package/src/components/mcp-permission-list.stories.tsx +21 -0
  89. package/src/components/mcp-permission-list.tsx +22 -0
  90. package/src/components/message-body-view.render.test.ts +0 -21
  91. package/src/components/message-list-pane.brief-filter.test.ts +0 -6
  92. package/src/components/message-list-pane.render.test.ts +0 -54
  93. package/src/components/message-list-state.render.test.ts +0 -84
  94. package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
  95. package/src/components/message-row.render.test.ts +1 -98
  96. package/src/components/mobile-message-action-bar.render.test.ts +0 -59
  97. package/src/components/mobile-reading-pane.render.test.ts +0 -48
  98. package/src/components/mobile-search-view.render.test.ts +0 -16
  99. package/src/components/mobile-search-view.stories.tsx +8 -11
  100. package/src/components/mobile-search-view.tsx +1 -1
  101. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  102. package/src/components/nav-sidebar.render.test.ts +2 -133
  103. package/src/components/new-folder-form.render.test.ts +0 -26
  104. package/src/components/outbox-row.render.test.ts +0 -9
  105. package/src/components/pane-layout.render.test.ts +0 -18
  106. package/src/components/plain-text-editor.mount.test.ts +0 -16
  107. package/src/components/popover-menu.render.test.ts +0 -11
  108. package/src/components/progress-bar.render.test.ts +0 -14
  109. package/src/components/quarantine-report.test.ts +0 -8
  110. package/src/components/quarantine-section.render.test.ts +16 -13
  111. package/src/components/quarantine-section.stories.tsx +11 -8
  112. package/src/components/reading-pane.render.test.ts +2 -106
  113. package/src/components/reading-pane.stories.tsx +3 -0
  114. package/src/components/refresh-button.render.test.ts +0 -9
  115. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  116. package/src/components/rich-text-editor.mount.test.ts +0 -19
  117. package/src/components/rich-text-image-node.ts +11 -9
  118. package/src/components/role-appointment-list.render.test.ts +0 -49
  119. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  120. package/src/components/row-actions.render.test.ts +0 -34
  121. package/src/components/search-bar.render.test.ts +0 -44
  122. package/src/components/search-chip-input.render.test.ts +0 -71
  123. package/src/components/search-conversion-notice.stories.tsx +0 -6
  124. package/src/components/search-conversion-notice.tsx +3 -9
  125. package/src/components/search-conversion.render.test.ts +0 -52
  126. package/src/components/search-conversion.ts +2 -18
  127. package/src/components/search-result-row.tsx +5 -26
  128. package/src/components/search-results.render.test.ts +0 -68
  129. package/src/components/search-results.stories.tsx +0 -30
  130. package/src/components/search-results.tsx +1 -1
  131. package/src/components/security-select.render.test.ts +1 -14
  132. package/src/components/selection-top-bar.render.test.ts +0 -180
  133. package/src/components/selection-wizard-fixtures.ts +0 -2
  134. package/src/components/selection-wizard.render.test.ts +7 -212
  135. package/src/components/selection-wizard.stories.tsx +24 -164
  136. package/src/components/selection-wizard.tsx +10 -86
  137. package/src/components/self-update.render.test.ts +0 -113
  138. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  139. package/src/components/shell-top-bar.render.test.ts +0 -31
  140. package/src/components/shell-top-bar.stories.tsx +7 -0
  141. package/src/components/shell-top-bar.tsx +11 -2
  142. package/src/components/slide-panel.render.test.ts +0 -18
  143. package/src/components/suggest-list.render.test.ts +0 -6
  144. package/src/components/swipeable-row.gesture.test.ts +0 -15
  145. package/src/components/swipeable-row.render.test.ts +0 -7
  146. package/src/components/sync-warning-fixtures.ts +22 -0
  147. package/src/components/sync-warning-report.ts +38 -0
  148. package/src/components/sync-warning-row.tsx +51 -0
  149. package/src/components/sync-warning-section.render.test.ts +19 -0
  150. package/src/components/sync-warning-section.stories.tsx +94 -0
  151. package/src/components/sync-warning-section.tsx +56 -0
  152. package/src/components/touch-list-body.render.test.ts +0 -29
  153. package/src/components/wizard.render.test.ts +0 -22
  154. package/src/filter-presets.test.ts +1 -107
  155. package/src/index.ts +40 -30
  156. package/src/lib/compose-language.test.ts +0 -11
  157. package/src/lib/email-render-treatment.test.ts +0 -21
  158. package/src/lib/keymap.test.ts +0 -32
  159. package/src/lib/property-prefill.ts +2 -2
  160. package/src/lib/search-rule.test.ts +0 -4
  161. package/src/lib/search-rule.ts +0 -9
  162. package/src/lib/sender-derivation.ts +3 -5
  163. package/src/lib/use-list-cursor.test.ts +0 -7
  164. package/src/lib/use-list-keyboard.test.ts +0 -14
  165. package/src/lib/use-modal-focus.test.ts +0 -20
  166. package/src/lib/use-selection.hook.test.ts +0 -13
  167. package/src/lib/use-selection.test.ts +0 -101
  168. package/src/lib/wizard-steps.test.ts +18 -79
  169. package/src/lib/wizard-steps.ts +27 -67
  170. package/src/mcp-pages.ts +36 -0
  171. package/src/category-presentation.test.ts +0 -76
  172. package/src/components/account-service-status.render.test.ts +0 -82
  173. package/src/components/app-password-hint.render.test.ts +0 -23
  174. package/src/components/app-top-bar.render.test.ts +0 -59
  175. package/src/components/auth-card.render.test.ts +0 -24
  176. package/src/components/auth-footer.render.test.ts +0 -17
  177. package/src/components/auth-hero.render.test.ts +0 -31
  178. package/src/components/auto-moved-badge.render.test.ts +0 -65
  179. package/src/components/button.render.test.ts +0 -29
  180. package/src/components/calendar-event-chip.render.test.ts +0 -67
  181. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  182. package/src/components/checkbox.render.test.ts +0 -65
  183. package/src/components/compose-form-shell.render.test.ts +0 -106
  184. package/src/components/dialog.render.test.ts +0 -51
  185. package/src/components/field-label.render.test.ts +0 -16
  186. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  187. package/src/components/nav-link-surface.render.test.ts +0 -126
  188. package/src/components/new-folder-action.render.test.ts +0 -44
  189. package/src/components/pane-header.render.test.ts +0 -22
  190. package/src/components/pull-to-refresh.render.test.ts +0 -46
  191. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  192. package/src/components/rescue-banner.render.test.ts +0 -32
  193. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  194. package/src/components/search-token-chip.render.test.ts +0 -42
  195. package/src/components/self-update-dot.tsx +0 -32
  196. package/src/components/settings-primitives.render.test.ts +0 -160
  197. package/src/lib/email-layout-clamp.test.ts +0 -139
  198. package/src/lib/label-color.test.ts +0 -25
  199. package/src/lib/semantic-off.ts +0 -20
  200. package/src/stories-viewport-globals.test.ts +0 -77
@@ -1,32 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { createElement } from "react";
4
- import { renderToString } from "react-dom/server";
5
- import { RescueBanner } from "./rescue-banner.js";
6
-
7
- const noop = () => {};
8
-
9
- describe("RescueBanner", () => {
10
- it("states the count in plain language and offers the action", () => {
11
- const html = renderToString(
12
- createElement(RescueBanner, { count: 5, onReview: noop }),
13
- );
14
- assert.match(html, /5 messages here/);
15
- assert.match(html, /senders we can verify/);
16
- assert.match(html, /Review & rescue/);
17
- });
18
-
19
- it("uses the singular form for one message", () => {
20
- const html = renderToString(
21
- createElement(RescueBanner, { count: 1, onReview: noop }),
22
- );
23
- assert.match(html, /1 message here/);
24
- });
25
-
26
- it("never leaks authentication jargon", () => {
27
- const html = renderToString(
28
- createElement(RescueBanner, { count: 3, onReview: noop }),
29
- );
30
- assert.doesNotMatch(html, /DKIM|SPF|DMARC|spam score/i);
31
- });
32
- });
@@ -1,68 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { createElement } from "react";
4
- import { renderToString } from "react-dom/server";
5
- import {
6
- type RescueCandidate,
7
- RescueCandidateRow,
8
- } from "./rescue-candidate-row.js";
9
-
10
- const candidate: RescueCandidate = {
11
- id: "1",
12
- senderName: "Anna de Vries",
13
- senderAddress: "anna@studio-noord.nl",
14
- subject: "Re: invoice",
15
- snippet: "final files attached",
16
- trustReason: "We can verify this sender",
17
- trustSubReason: "You've emailed them before",
18
- senderTrust: "wellknown",
19
- };
20
-
21
- const noop = () => {};
22
-
23
- describe("RescueCandidateRow", () => {
24
- it("renders sender, subject and the plain-language trust reason", () => {
25
- const html = renderToString(
26
- createElement(RescueCandidateRow, {
27
- candidate,
28
- selected: true,
29
- onToggle: noop,
30
- }),
31
- );
32
- assert.match(html, /Anna de Vries/);
33
- assert.match(html, /We can verify this sender/);
34
- assert.match(html, /emailed them before/);
35
- });
36
-
37
- it("never leaks authentication jargon to the user", () => {
38
- const html = renderToString(
39
- createElement(RescueCandidateRow, {
40
- candidate,
41
- selected: false,
42
- onToggle: noop,
43
- }),
44
- );
45
- assert.doesNotMatch(html, /DKIM|SPF|DMARC/i);
46
- });
47
-
48
- it("uses a real checkbox that reflects selection", () => {
49
- const selectedHtml = renderToString(
50
- createElement(RescueCandidateRow, {
51
- candidate,
52
- selected: true,
53
- onToggle: noop,
54
- }),
55
- );
56
- assert.match(selectedHtml, /type="checkbox"/);
57
- assert.match(selectedHtml, /checked=""/);
58
-
59
- const unselectedHtml = renderToString(
60
- createElement(RescueCandidateRow, {
61
- candidate,
62
- selected: false,
63
- onToggle: noop,
64
- }),
65
- );
66
- assert.doesNotMatch(unselectedHtml, /checked=""/);
67
- });
68
- });
@@ -1,42 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { createElement } from "react";
4
- import { renderToString } from "react-dom/server";
5
- import { SearchTokenChip, SearchTokenChips } from "./search-token-chip.js";
6
-
7
- const noop = () => {};
8
-
9
- describe("SearchTokenChip", () => {
10
- it("renders the label and a remove control", () => {
11
- const html = renderToString(
12
- createElement(SearchTokenChip, {
13
- label: "Has attachment",
14
- onRemove: noop,
15
- }),
16
- );
17
- assert.match(html, /Has attachment/);
18
- assert.match(html, /aria-label="Remove filter: Has attachment"/);
19
- });
20
- });
21
-
22
- describe("SearchTokenChips", () => {
23
- it("renders nothing for an empty token list", () => {
24
- assert.equal(
25
- renderToString(createElement(SearchTokenChips, { tokens: [] })),
26
- "",
27
- );
28
- });
29
-
30
- it("renders one chip per token", () => {
31
- const html = renderToString(
32
- createElement(SearchTokenChips, {
33
- tokens: [
34
- { label: "Unread", onRemove: noop },
35
- { label: "From: alice", onRemove: noop },
36
- ],
37
- }),
38
- );
39
- assert.match(html, /Unread/);
40
- assert.match(html, /From: alice/);
41
- });
42
- });
@@ -1,32 +0,0 @@
1
- import type { ReactNode } from "react";
2
-
3
- export interface UpdateAvailableDotProps {
4
- /** The icon or control the hint is attached to. */
5
- children?: ReactNode;
6
- show: boolean;
7
- /** Read out to assistive tech in place of the bare dot. */
8
- label?: string;
9
- }
10
-
11
- /**
12
- * The only place an available update is allowed to reach outside settings: a
13
- * dot on the way there. It carries no count, no copy and no action, so it can
14
- * never grow into a prompt over someone's mail.
15
- */
16
- export function UpdateAvailableDot({
17
- children,
18
- show,
19
- label = "Update available",
20
- }: UpdateAvailableDotProps) {
21
- return (
22
- <span className="relative inline-flex">
23
- {children}
24
- {show && (
25
- <>
26
- <span className="absolute -right-1 -top-1 size-2 rounded-full bg-accent-2" />
27
- <span className="sr-only">{label}</span>
28
- </>
29
- )}
30
- </span>
31
- );
32
- }
@@ -1,160 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { createElement } from "react";
4
- import { renderToString } from "react-dom/server";
5
- import { Button } from "./button.js";
6
- import { DangerZoneSection } from "./danger-zone-section.js";
7
- import { SegmentedControl } from "./segmented-control.js";
8
- import { SenderGroupSwitch } from "./sender-group-switch.js";
9
- import { SettingsShell } from "./settings-screen.js";
10
-
11
- describe("SegmentedControl (#802)", () => {
12
- it("is a radiogroup with one checked radio and thumb-sized targets", () => {
13
- const html = renderToString(
14
- createElement(SegmentedControl, {
15
- name: "density",
16
- value: "compact",
17
- onChange: () => undefined,
18
- options: [
19
- { value: "comfortable", label: "Comfortable" },
20
- { value: "compact", label: "Compact" },
21
- ],
22
- }),
23
- );
24
- assert.match(html, /role="radiogroup"/);
25
- assert.match(html, /min-h-11/);
26
- assert.equal((html.match(/type="radio"/g) ?? []).length, 2);
27
- assert.match(html, /checked[^>]*value="compact"/);
28
- });
29
-
30
- it("active thumb uses filled card shadow (#848)", () => {
31
- const html = renderToString(
32
- createElement(SegmentedControl, {
33
- name: "theme",
34
- value: "system",
35
- onChange: () => undefined,
36
- options: [
37
- { value: "system", label: "System" },
38
- { value: "light", label: "Light" },
39
- { value: "dark", label: "Dark" },
40
- ],
41
- }),
42
- );
43
- // shadow (not shadow-sm) on the active thumb
44
- assert.match(html, /bg-surface[^"]*\bshadow\b/);
45
- });
46
-
47
- it("renders dividers between inactive segments (#848)", () => {
48
- // active = system (index 0): light→dark boundary gets a divider
49
- const html = renderToString(
50
- createElement(SegmentedControl, {
51
- name: "theme",
52
- value: "system",
53
- onChange: () => undefined,
54
- options: [
55
- { value: "system", label: "System" },
56
- { value: "light", label: "Light" },
57
- { value: "dark", label: "Dark" },
58
- ],
59
- }),
60
- );
61
- assert.match(html, /after:bg-line/);
62
- });
63
- });
64
-
65
- describe("SenderGroupSwitch (#790)", () => {
66
- it("renders a tablist that is a strip on mobile and a rail (lg) on desktop", () => {
67
- const html = renderToString(
68
- createElement(SenderGroupSwitch, {
69
- active: "vip",
70
- onSelect: () => undefined,
71
- options: [
72
- { id: "vip", label: "VIPs", count: 12 },
73
- { id: "muted", label: "Muted", count: null },
74
- { id: "blocked", label: "Blocked", count: null },
75
- ],
76
- }),
77
- );
78
- assert.match(html, /role="tablist"/);
79
- assert.match(html, /lg:w-44/);
80
- assert.match(html, /lg:flex-col/);
81
- assert.match(html, /aria-selected="true"/);
82
- assert.match(html, /—/);
83
- });
84
- });
85
-
86
- describe("DangerZoneSection (#791)", () => {
87
- it("keeps the strong 'Delete your Remit account' label and renders its action", () => {
88
- const html = renderToString(
89
- createElement(DangerZoneSection, {
90
- title: "Delete your Remit account",
91
- description: "Disconnects every account.",
92
- action: createElement(
93
- Button,
94
- { variant: "danger", size: "sm" },
95
- "Delete your Remit account",
96
- ),
97
- }),
98
- );
99
- assert.equal(
100
- (html.match(/Delete your Remit account/g) ?? []).length >= 2,
101
- true,
102
- );
103
- assert.match(html, /Danger zone/);
104
- });
105
- });
106
-
107
- describe("SettingsShell responsive (#789)", () => {
108
- const shell = (flush?: boolean) =>
109
- renderToString(
110
- createElement(SettingsShell, {
111
- items: [
112
- { id: "accounts", label: "Accounts" },
113
- { id: "senders", label: "Senders & Rules" },
114
- ],
115
- activeId: "accounts",
116
- title: "Accounts",
117
- help: createElement("p", null, "tips"),
118
- flush,
119
- // biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
120
- children: createElement("div", null, "pane body"),
121
- }),
122
- );
123
-
124
- const shellNoHelp = () =>
125
- renderToString(
126
- createElement(SettingsShell, {
127
- items: [
128
- { id: "accounts", label: "Accounts" },
129
- { id: "senders", label: "Senders & Rules" },
130
- ],
131
- activeId: "accounts",
132
- title: "Accounts",
133
- // biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
134
- children: createElement("div", null, "pane body"),
135
- }),
136
- );
137
-
138
- it("hides the nav rail below desktop and shows a menu button to reach it", () => {
139
- const html = shell();
140
- assert.match(html, /hidden w-60[^"]*lg:flex/);
141
- assert.match(html, /aria-label="Open settings menu"/);
142
- });
143
-
144
- it("folds the tips rail to desktop-only with a mobile tips disclosure", () => {
145
- const html = shell();
146
- assert.match(html, /hidden w-64[^"]*lg:flex/);
147
- assert.match(html, /aria-label="Tips"/);
148
- });
149
-
150
- it("renders the active pane content so it is reachable on every width", () => {
151
- assert.match(shell(), /pane body/);
152
- assert.match(shell(true), /pane body/);
153
- });
154
-
155
- it("omits the tips toggle when no help prop is passed (#872)", () => {
156
- const html = shellNoHelp();
157
- assert.doesNotMatch(html, /aria-label="Tips"/);
158
- assert.doesNotMatch(html, /aria-label="Show tips"/);
159
- });
160
- });
@@ -1,139 +0,0 @@
1
- import assert from "node:assert";
2
- import { describe, test } from "node:test";
3
- import { generateLayoutClampCSS } from "./email-layout-clamp.js";
4
-
5
- /**
6
- * Layout-clamp CSS injected alongside sanitized email HTML. Asserts on
7
- * substrings — the goal is to lock in the rules that close #374 / #727 (mobile
8
- * horizontal overflow when author markup is wider than the viewport). If any of
9
- * these get dropped, wide tables / images / long URLs would start unlocking
10
- * horizontal page scroll again.
11
- *
12
- * The sanitizer drops the email body straight into the iframe with no
13
- * `.email-content` wrapper, so the rules target the document's own
14
- * `html`/`body` and bare element selectors — a wrapper-scoped selector would
15
- * never match and the clamp would silently do nothing (the original #727 bug).
16
- *
17
- * Pure string assertions — no DOM required, intentionally separate from
18
- * `email-sanitizer.test.ts` because importing `email-sanitizer.ts` in plain
19
- * Node fails on its eager `DOMPurify()` call at module load.
20
- */
21
- describe("generateLayoutClampCSS (#374 / #727)", () => {
22
- const css = generateLayoutClampCSS();
23
-
24
- test("targets the document body directly, not a wrapper that never exists", () => {
25
- // The sanitized email has no `.email-content` element — scoping there
26
- // was the #727 bug (dead CSS). Rules must hit bare element selectors.
27
- assert.ok(
28
- !css.includes(".email-content"),
29
- "clamp rules must not be scoped to a non-existent .email-content wrapper",
30
- );
31
- });
32
-
33
- test("zeros UA default html/body margin so iframe content fills edge-to-edge", () => {
34
- assert.ok(
35
- /html\s*,\s*body\s*\{[^}]*margin\s*:\s*0/.test(css),
36
- "html, body margin must be reset to 0",
37
- );
38
- assert.ok(
39
- /html\s*,\s*body\s*\{[^}]*padding\s*:\s*0/.test(css),
40
- "html, body padding must be reset to 0",
41
- );
42
- });
43
-
44
- test("clamps the document to the iframe width and wraps long tokens", () => {
45
- assert.ok(css.includes("max-width: 100%"));
46
- assert.ok(css.includes("overflow-wrap: anywhere"));
47
- assert.ok(css.includes("word-break: break-word"));
48
- });
49
-
50
- test("forces wide media (img/video/iframe) to fit the frame", () => {
51
- assert.ok(/(^|\s)img\s*,/.test(css) || /\bimg\b/.test(css));
52
- assert.ok(/\bvideo\b/.test(css));
53
- assert.ok(/\biframe\b/.test(css));
54
- // Author markup often sets `width="900"` — without !important we lose
55
- // the cascade and the image overflows again.
56
- assert.ok(
57
- css.includes("max-width: 100% !important"),
58
- "images need !important to override author width attributes",
59
- );
60
- });
61
-
62
- test("clamps fixed-width newsletter tables", () => {
63
- assert.ok(/\btable\b/.test(css));
64
- assert.ok(
65
- css.includes("max-width: 100% !important"),
66
- "author <table width='600'> must be capped to the frame width",
67
- );
68
- assert.ok(css.includes("table-layout: auto"));
69
- });
70
-
71
- test("clamps fixed-width table cells (the real width carriers in newsletters)", () => {
72
- // Newsletters pin widths on `<td width="600">`, not just the table.
73
- assert.ok(
74
- /\btd\s*,\s*th\b/.test(css),
75
- "td, th must be capped to the frame",
76
- );
77
- assert.ok(
78
- /td\s*,\s*th\s*\{[^}]*max-width:\s*100%\s*!important/.test(css),
79
- "cell widths need !important to override author width attributes",
80
- );
81
- });
82
-
83
- test("zeros min-width so children can shrink below their intrinsic width", () => {
84
- // `max-width` alone can't override an inline `min-width`; flex/grid/table
85
- // children won't collapse without this.
86
- assert.ok(
87
- /\*\s*\{[^}]*min-width:\s*0/.test(css),
88
- "a universal min-width:0 must let wide children shrink to the clamp",
89
- );
90
- });
91
-
92
- test("overrides an author nowrap so flowing text can never be clipped", () => {
93
- // The frame is the pane's width, so a pinned paragraph is read by dragging
94
- // the whole email sideways; inside an author `overflow:hidden` it is cut
95
- // mid-character with nothing to scroll at all.
96
- assert.ok(
97
- /\[nowrap\][^{]*\{[^}]*white-space:\s*normal\s*!important/.test(css),
98
- "a nowrap attribute must not pin a line wider than the frame",
99
- );
100
- assert.ok(
101
- /\[style\*="nowrap" i\][^{]*\{[^}]*white-space:\s*normal\s*!important/.test(
102
- css,
103
- ),
104
- "an inline white-space:nowrap must not pin a line wider than the frame",
105
- );
106
- assert.ok(
107
- /\[style\*="nowrap" i\]/.test(css),
108
- "Outlook emits WHITE-SPACE: NOWRAP — the attribute match must ignore case",
109
- );
110
- assert.ok(
111
- /\[nowrap\]:not\(pre, code, pre \*, code \*\)/.test(css),
112
- "pre/code AND their descendants keep their own whitespace handling",
113
- );
114
- assert.ok(
115
- /:is\(pre, code, pre \*, code \*\):is\(\[nowrap\], \[style\*="nowrap" i\]\)[^{]*\{[^}]*white-space:\s*pre-wrap\s*!important/.test(
116
- css,
117
- ),
118
- "a nowrap inside a pre wraps rather than collapsing the block's spacing",
119
- );
120
- });
121
-
122
- test("wraps long unbroken lines in pre/code blocks", () => {
123
- assert.ok(/\bpre\b/.test(css));
124
- assert.ok(/\bcode\b/.test(css));
125
- assert.ok(css.includes("white-space: pre-wrap"));
126
- });
127
-
128
- test("does not touch colors or backgrounds (layout-only, by design)", () => {
129
- // If any of these slip in, this stylesheet starts overlapping with
130
- // the dark-mode / smart-invert CSS and the rule set is no longer
131
- // scoped to the bug we're fixing. Keep it laser-focused on width/wrap.
132
- assert.ok(!/\bcolor\s*:/.test(css), "no color rules in layout clamp");
133
- assert.ok(
134
- !/\bbackground(-color)?\s*:/.test(css),
135
- "no background rules in layout clamp",
136
- );
137
- assert.ok(!/\bfont-/.test(css), "no font rules in layout clamp");
138
- });
139
- });
@@ -1,25 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import {
4
- isLabelColorValue,
5
- labelColorOptions,
6
- labelDotClass,
7
- } from "./label-color.js";
8
-
9
- describe("label-color", () => {
10
- it("every listed option resolves to a dot class", () => {
11
- for (const color of labelColorOptions) {
12
- assert.ok(labelDotClass[color]);
13
- }
14
- });
15
-
16
- it("recognizes every named color value", () => {
17
- for (const color of labelColorOptions) {
18
- assert.ok(isLabelColorValue(color));
19
- }
20
- });
21
-
22
- it("rejects a value outside the named set", () => {
23
- assert.equal(isLabelColorValue("Chartreuse"), false);
24
- });
25
- });
@@ -1,20 +0,0 @@
1
- /**
2
- * What the surfaces backed by stored message vectors say on an instance with
3
- * semantic search off (#1068).
4
- *
5
- * Off is a deployment setting, not a failure, so the copy names the command
6
- * that changes it and what changing it buys: the Organize widen to similar
7
- * mail, and filters that match on similarity. It deliberately promises nothing
8
- * about the "Similar messages" panel filling — answering a typed query needs a
9
- * query embedder no self-host image carries, so that panel is empty either way
10
- * (deploy/vps/README.md, Search).
11
- */
12
- export const SEMANTIC_OFF_TITLE = "Semantic search is off on this instance.";
13
-
14
- export const SEMANTIC_OFF_BUYS =
15
- "On, it stores a vector for every message, which is what the Organize widen to similar mail and semantic filters read.";
16
-
17
- export const SEMANTIC_OFF_COMMAND = "remit semantic on";
18
-
19
- /** The same three facts as one line, for a surface with room for one. */
20
- export const semanticOffReason = `${SEMANTIC_OFF_TITLE} ${SEMANTIC_OFF_BUYS} Run '${SEMANTIC_OFF_COMMAND}' on the server.`;
@@ -1,77 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { readdirSync, readFileSync } from "node:fs";
3
- import { dirname, relative, resolve } from "node:path";
4
- import { describe, it } from "node:test";
5
- import { fileURLToPath } from "node:url";
6
-
7
- /**
8
- * Storybook 9 dropped `parameters.viewport.defaultViewport` (present through
9
- * Storybook 8) — it is silently ignored, so a story written against it
10
- * renders full width instead of the intended breakpoint. The replacement is
11
- * a per-story viewport global: `globals: { viewport: { value: "mobile" } }`
12
- * (#67, #68).
13
- */
14
-
15
- const here = dirname(fileURLToPath(import.meta.url));
16
-
17
- const storyFiles = (root: string): string[] => {
18
- const found: string[] = [];
19
- const walk = (dir: string): void => {
20
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
21
- if (entry.isDirectory() && entry.name !== "node_modules") {
22
- walk(resolve(dir, entry.name));
23
- continue;
24
- }
25
- if (entry.isFile() && entry.name.endsWith(".stories.tsx")) {
26
- found.push(resolve(dir, entry.name));
27
- }
28
- }
29
- };
30
- walk(root);
31
- return found;
32
- };
33
-
34
- describe("story files use the viewport globals pattern (#68)", () => {
35
- const roots = [
36
- here,
37
- resolve(here, "../../workbench/src"),
38
- resolve(here, "../../web-client/src"),
39
- ];
40
-
41
- it("scans at least one story file", () => {
42
- const files = roots.flatMap((root) => storyFiles(root));
43
- assert.ok(files.length > 0);
44
- });
45
-
46
- it("never references parameters.viewport.defaultViewport", () => {
47
- const offenders = roots
48
- .flatMap((root) => storyFiles(root))
49
- .filter((file) => readFileSync(file, "utf8").includes("defaultViewport"))
50
- .map((file) => relative(here, file));
51
- assert.deepEqual(offenders, []);
52
- });
53
- });
54
-
55
- /**
56
- * Storybook composes decorators story → component → global, so a story-level
57
- * `decorators: []` adds nothing. It reads as "this story opts out of the meta's
58
- * frame" and silently does the opposite, which clipped a story down to half its
59
- * content. A story that needs a different frame carries the frame itself.
60
- */
61
- describe("story files never claim to shed a meta decorator", () => {
62
- const roots = [
63
- here,
64
- resolve(here, "../../workbench/src"),
65
- resolve(here, "../../web-client/src"),
66
- ];
67
-
68
- it("never uses an empty story-level decorators array", () => {
69
- const offenders = roots
70
- .flatMap((root) => storyFiles(root))
71
- .filter((file) =>
72
- /decorators:\s*\[\s*\]/.test(readFileSync(file, "utf8")),
73
- )
74
- .map((file) => relative(here, file));
75
- assert.deepEqual(offenders, []);
76
- });
77
- });