@remit/ui 0.0.221 → 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.
- package/package.json +14 -3
- package/src/components/DropdownMenu.tsx +100 -0
- package/src/components/EmptyState.tsx +11 -0
- package/src/components/ErrorBanner.render.test.ts +107 -0
- package/src/components/ErrorBanner.stories.tsx +132 -0
- package/src/components/ErrorBanner.tsx +122 -0
- package/src/components/ErrorBannerStack.tsx +34 -0
- package/src/components/ErrorState.render.test.ts +82 -0
- package/src/components/ErrorState.tsx +80 -0
- package/src/components/KeyboardShortcutsModal.tsx +111 -0
- package/src/components/account-service-change-dialog.render.test.ts +1 -41
- package/src/components/account-service-choice.render.test.ts +0 -26
- package/src/components/account-service-toggles.render.test.ts +0 -6
- package/src/components/address-display.render.test.ts +1 -38
- package/src/components/address-tag.render.test.ts +0 -11
- package/src/components/agenda-flow.reach.test.ts +0 -8
- package/src/components/agenda-flow.render.test.ts +0 -31
- package/src/components/agenda-panels.render.test.ts +0 -5
- package/src/components/app-shell-slotted.render.test.ts +0 -118
- package/src/components/attachment-list.render.test.ts +41 -24
- package/src/components/attachment-list.stories.tsx +67 -0
- package/src/components/attachment-list.tsx +112 -35
- package/src/components/attendee-row.render.test.ts +0 -41
- package/src/components/attention-dot.stories.tsx +46 -0
- package/src/components/attention-dot.tsx +23 -0
- package/src/components/banner.render.test.ts +0 -7
- package/src/components/bottom-sheet.render.test.ts +0 -42
- package/src/components/brief-section.render.test.ts +0 -13
- package/src/components/brief-sections.keyboard.test.ts +0 -13
- package/src/components/brief-sections.render.test.ts +0 -22
- package/src/components/calendar-clash-strip.render.test.ts +0 -19
- package/src/components/calendar-grid.render.test.ts +0 -79
- package/src/components/calendar-invite-card.render.test.ts +0 -19
- package/src/components/calendar-list.render.test.ts +0 -21
- package/src/components/calendar-slot-offers.render.test.ts +0 -24
- package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
- package/src/components/calendar-toolbar.render.test.ts +1 -53
- package/src/components/category-badge.render.test.ts +1 -24
- package/src/components/compose-action-bar.render.test.ts +0 -5
- package/src/components/compose-attachments.render.test.ts +0 -38
- package/src/components/event-detail.render.test.ts +0 -27
- package/src/components/event-editor.render.test.ts +0 -4
- package/src/components/event-suggestion-card.render.test.ts +0 -61
- package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
- package/src/components/filter-clause-chip.tsx +1 -60
- package/src/components/filter-rule-editor.create.test.ts +0 -6
- package/src/components/filter-rule-editor.stories.tsx +24 -138
- package/src/components/filter-rule-editor.tsx +7 -93
- package/src/components/filter-rule.render.test.ts +9 -299
- package/src/components/filter-rule.ts +20 -85
- package/src/components/filter-sheet.render.test.ts +0 -7
- package/src/components/folder-manage-actions.render.test.ts +0 -13
- package/src/components/folder-manager.render.test.ts +0 -31
- package/src/components/folder-mutation-dialog.render.test.ts +0 -83
- package/src/components/folder-rename-dialog.render.test.ts +0 -14
- package/src/components/folder-row.render.test.ts +0 -30
- package/src/components/folder-sync-state.test.ts +0 -61
- package/src/components/folder-tree-picker.create.test.ts +0 -30
- package/src/components/folder-tree-picker.render.test.ts +0 -35
- package/src/components/intelligence-calendar-fixtures.ts +0 -2
- package/src/components/intelligence-calendar.render.test.ts +0 -4
- package/src/components/intelligence-panel.render.test.ts +1 -62
- package/src/components/intelligence-panel.stories.tsx +0 -76
- package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
- package/src/components/intelligence-panel.tsx +6 -176
- package/src/components/intelligence-toggle.render.test.ts +0 -5
- package/src/components/isolated-email-frame.render.test.ts +0 -122
- package/src/components/isolated-email-frame.tsx +55 -3
- package/src/components/keyboard-hint-bar.render.test.ts +0 -7
- package/src/components/label-chip.render.test.ts +0 -28
- package/src/components/label-chip.tsx +1 -1
- package/src/components/mail-header.render.test.ts +0 -20
- package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
- package/src/components/mcp-connected-apps-page.tsx +79 -0
- package/src/components/mcp-consent-page.stories.tsx +39 -0
- package/src/components/mcp-consent-page.tsx +47 -0
- package/src/components/mcp-device-page.stories.tsx +57 -0
- package/src/components/mcp-device-page.tsx +107 -0
- package/src/components/mcp-error-notice.stories.tsx +34 -0
- package/src/components/mcp-error-notice.tsx +23 -0
- package/src/components/mcp-error-page.stories.tsx +17 -0
- package/src/components/mcp-error-page.tsx +15 -0
- package/src/components/mcp-fixtures.ts +16 -0
- package/src/components/mcp-login-page.stories.tsx +37 -0
- package/src/components/mcp-login-page.tsx +58 -0
- package/src/components/mcp-page.stories.tsx +27 -0
- package/src/components/mcp-page.tsx +35 -0
- package/src/components/mcp-permission-list.stories.tsx +21 -0
- package/src/components/mcp-permission-list.tsx +22 -0
- package/src/components/message-body-view.render.test.ts +0 -21
- package/src/components/message-list-pane.brief-filter.test.ts +0 -6
- package/src/components/message-list-pane.render.test.ts +0 -54
- package/src/components/message-list-state.render.test.ts +0 -84
- package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
- package/src/components/message-row.render.test.ts +1 -98
- package/src/components/mobile-message-action-bar.render.test.ts +0 -59
- package/src/components/mobile-reading-pane.render.test.ts +0 -48
- package/src/components/mobile-reading-pane.stories.tsx +78 -0
- package/src/components/mobile-reading-pane.tsx +55 -41
- package/src/components/mobile-search-view.render.test.ts +0 -16
- package/src/components/mobile-search-view.stories.tsx +8 -11
- package/src/components/mobile-search-view.tsx +1 -1
- package/src/components/nav-sidebar.keyboard.test.ts +0 -8
- package/src/components/nav-sidebar.render.test.ts +2 -133
- package/src/components/new-folder-form.render.test.ts +0 -26
- package/src/components/outbox-row.render.test.ts +0 -9
- package/src/components/pane-layout.render.test.ts +0 -18
- package/src/components/plain-text-editor.mount.test.ts +0 -16
- package/src/components/popover-menu.render.test.ts +0 -11
- package/src/components/progress-bar.render.test.ts +0 -14
- package/src/components/quarantine-report.test.ts +0 -8
- package/src/components/quarantine-section.render.test.ts +16 -13
- package/src/components/quarantine-section.stories.tsx +11 -8
- package/src/components/reading-pane.render.test.ts +2 -106
- package/src/components/reading-pane.stories.tsx +3 -0
- package/src/components/refresh-button.render.test.ts +0 -9
- package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
- package/src/components/rich-text-editor.mount.test.ts +0 -19
- package/src/components/rich-text-image-node.ts +11 -9
- package/src/components/role-appointment-list.render.test.ts +0 -49
- package/src/components/role-appointment-prompt.render.test.ts +0 -79
- package/src/components/row-actions.render.test.ts +0 -34
- package/src/components/search-bar.render.test.ts +0 -44
- package/src/components/search-chip-input.render.test.ts +0 -71
- package/src/components/search-conversion-notice.stories.tsx +0 -6
- package/src/components/search-conversion-notice.tsx +3 -9
- package/src/components/search-conversion.render.test.ts +0 -52
- package/src/components/search-conversion.ts +2 -18
- package/src/components/search-result-row.tsx +5 -26
- package/src/components/search-results.render.test.ts +0 -68
- package/src/components/search-results.stories.tsx +0 -30
- package/src/components/search-results.tsx +1 -1
- package/src/components/security-select.render.test.ts +1 -14
- package/src/components/selection-top-bar.render.test.ts +0 -180
- package/src/components/selection-wizard-fixtures.ts +0 -2
- package/src/components/selection-wizard.render.test.ts +7 -212
- package/src/components/selection-wizard.stories.tsx +24 -164
- package/src/components/selection-wizard.tsx +10 -86
- package/src/components/self-update.render.test.ts +0 -113
- package/src/components/sender-trust-indicator.render.test.ts +0 -30
- package/src/components/shell-top-bar.render.test.ts +0 -31
- package/src/components/shell-top-bar.stories.tsx +7 -0
- package/src/components/shell-top-bar.tsx +11 -2
- package/src/components/slide-panel.render.test.ts +0 -18
- package/src/components/suggest-list.render.test.ts +0 -6
- package/src/components/swipeable-row.gesture.test.ts +85 -40
- package/src/components/swipeable-row.render.test.ts +0 -7
- package/src/components/swipeable-row.stories.tsx +3 -2
- package/src/components/swipeable-row.tsx +65 -144
- package/src/components/sync-warning-fixtures.ts +22 -0
- package/src/components/sync-warning-report.ts +38 -0
- package/src/components/sync-warning-row.tsx +51 -0
- package/src/components/sync-warning-section.render.test.ts +19 -0
- package/src/components/sync-warning-section.stories.tsx +94 -0
- package/src/components/sync-warning-section.tsx +56 -0
- package/src/components/touch-list-body.render.test.ts +0 -29
- package/src/components/wizard.render.test.ts +0 -22
- package/src/filter-presets.test.ts +1 -107
- package/src/index.ts +40 -34
- package/src/lib/compose-language.test.ts +0 -11
- package/src/lib/email-render-treatment.test.ts +0 -21
- package/src/lib/keymap.test.ts +0 -32
- package/src/lib/property-prefill.ts +2 -2
- package/src/lib/search-rule.test.ts +0 -4
- package/src/lib/search-rule.ts +0 -9
- package/src/lib/sender-derivation.ts +3 -5
- package/src/lib/swipe-config.ts +11 -0
- package/src/lib/use-list-cursor.test.ts +0 -7
- package/src/lib/use-list-keyboard.test.ts +0 -14
- package/src/lib/use-long-press.test.ts +53 -36
- package/src/lib/use-long-press.ts +62 -56
- package/src/lib/use-modal-focus.test.ts +0 -20
- package/src/lib/use-selection.hook.test.ts +0 -13
- package/src/lib/use-selection.test.ts +0 -101
- package/src/lib/use-swipe-navigation.test.ts +162 -0
- package/src/lib/use-swipe-navigation.ts +90 -0
- package/src/lib/wizard-steps.test.ts +18 -79
- package/src/lib/wizard-steps.ts +27 -67
- package/src/mcp-pages.ts +36 -0
- package/src/category-presentation.test.ts +0 -76
- package/src/components/account-service-status.render.test.ts +0 -82
- package/src/components/app-password-hint.render.test.ts +0 -23
- package/src/components/app-top-bar.render.test.ts +0 -59
- package/src/components/auth-card.render.test.ts +0 -24
- package/src/components/auth-footer.render.test.ts +0 -17
- package/src/components/auth-hero.render.test.ts +0 -31
- package/src/components/auto-moved-badge.render.test.ts +0 -65
- package/src/components/button.render.test.ts +0 -29
- package/src/components/calendar-event-chip.render.test.ts +0 -67
- package/src/components/calendar-parse-badge.render.test.ts +0 -40
- package/src/components/checkbox.render.test.ts +0 -65
- package/src/components/compose-form-shell.render.test.ts +0 -106
- package/src/components/dialog.render.test.ts +0 -51
- package/src/components/field-label.render.test.ts +0 -16
- package/src/components/mail-action-toolbar.render.test.ts +0 -43
- package/src/components/nav-link-surface.render.test.ts +0 -126
- package/src/components/new-folder-action.render.test.ts +0 -44
- package/src/components/pane-header.render.test.ts +0 -22
- package/src/components/pull-to-refresh.render.test.ts +0 -46
- package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
- package/src/components/rescue-banner.render.test.ts +0 -32
- package/src/components/rescue-candidate-row.render.test.ts +0 -68
- package/src/components/search-token-chip.render.test.ts +0 -42
- package/src/components/self-update-dot.tsx +0 -32
- package/src/components/settings-primitives.render.test.ts +0 -160
- package/src/lib/email-layout-clamp.test.ts +0 -139
- package/src/lib/label-color.test.ts +0 -25
- package/src/lib/semantic-off.ts +0 -20
- package/src/stories-viewport-globals.test.ts +0 -77
|
@@ -9,18 +9,13 @@ import {
|
|
|
9
9
|
Star,
|
|
10
10
|
X,
|
|
11
11
|
} from "lucide-react";
|
|
12
|
-
import { type
|
|
12
|
+
import { type ReactNode, useId, useState } from "react";
|
|
13
13
|
import {
|
|
14
14
|
categoryLabels,
|
|
15
15
|
categoryTone,
|
|
16
16
|
type ThreadCategory,
|
|
17
17
|
} from "../category-presentation.js";
|
|
18
18
|
import { cn } from "../lib/cn.js";
|
|
19
|
-
import {
|
|
20
|
-
SEMANTIC_OFF_BUYS,
|
|
21
|
-
SEMANTIC_OFF_COMMAND,
|
|
22
|
-
SEMANTIC_OFF_TITLE,
|
|
23
|
-
} from "../lib/semantic-off.js";
|
|
24
19
|
import { Avatar } from "./avatar.js";
|
|
25
20
|
import { Badge } from "./badge.js";
|
|
26
21
|
import { Button } from "./button.js";
|
|
@@ -34,8 +29,8 @@ import { SegmentedControl } from "./segmented-control.js";
|
|
|
34
29
|
|
|
35
30
|
/* ------------------------------------------------------------------ */
|
|
36
31
|
/* The fourth pane: mail intelligence. Driven by real backend signals */
|
|
37
|
-
/* (Address engagement counters, DKIM-mismatch category heuristics
|
|
38
|
-
/*
|
|
32
|
+
/* (Address engagement counters, DKIM-mismatch category heuristics) */
|
|
33
|
+
/* with reserved slots for local-LLM and Bedrock */
|
|
39
34
|
/* features. Silent when there is nothing to say; loudest element on */
|
|
40
35
|
/* the screen when authenticity fails. */
|
|
41
36
|
/* ------------------------------------------------------------------ */
|
|
@@ -84,49 +79,8 @@ export interface AuthenticityIntel {
|
|
|
84
79
|
* domain-comparison line (there is no valid domain to show).
|
|
85
80
|
*/
|
|
86
81
|
addressUnreadable?: boolean;
|
|
87
|
-
/** Count of semantically similar messages (the campaign, not the instance). */
|
|
88
|
-
similarCount?: number;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export type MatchedChunk =
|
|
92
|
-
| "sender"
|
|
93
|
-
| "recipient"
|
|
94
|
-
| "subject"
|
|
95
|
-
| "attachment"
|
|
96
|
-
| "body"
|
|
97
|
-
| "entities";
|
|
98
|
-
|
|
99
|
-
export interface SimilarMessageIntel {
|
|
100
|
-
id: string;
|
|
101
|
-
/** Mailbox the message lives in — the route param for opening it. */
|
|
102
|
-
mailboxId: string;
|
|
103
|
-
/** Conversation the message belongs to, which is what the reading pane opens. */
|
|
104
|
-
threadId: string;
|
|
105
|
-
fromName: string;
|
|
106
|
-
subject: string;
|
|
107
|
-
timeLabel: string;
|
|
108
|
-
matched: MatchedChunk;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Renders a similar-message row as a real anchor so middle-click /
|
|
113
|
-
* open-in-new-tab / deep-linking / screen-reader link semantics all work. The
|
|
114
|
-
* web-client passes a router `<Link>` builder; when omitted the row falls back
|
|
115
|
-
* to a non-navigating element that preserves the visual (static stories).
|
|
116
|
-
*/
|
|
117
|
-
export interface SimilarMessageLinkProps {
|
|
118
|
-
mailboxId: string;
|
|
119
|
-
threadId: string;
|
|
120
|
-
messageId: string;
|
|
121
|
-
className: string;
|
|
122
|
-
ariaLabel?: string;
|
|
123
|
-
children: ReactNode;
|
|
124
82
|
}
|
|
125
83
|
|
|
126
|
-
export type SimilarMessageLinkComponent = (
|
|
127
|
-
props: SimilarMessageLinkProps,
|
|
128
|
-
) => ReactElement;
|
|
129
|
-
|
|
130
84
|
export interface SenderFlagsIntel {
|
|
131
85
|
vip?: boolean;
|
|
132
86
|
muted?: boolean;
|
|
@@ -148,7 +102,6 @@ export interface IntelligenceData {
|
|
|
148
102
|
authenticity: AuthenticityIntel;
|
|
149
103
|
category: { value: ThreadCategory; overridden?: boolean };
|
|
150
104
|
flags?: SenderFlagsIntel;
|
|
151
|
-
similar: SimilarMessageIntel[];
|
|
152
105
|
}
|
|
153
106
|
|
|
154
107
|
export interface IntelligenceQuickActions {
|
|
@@ -170,18 +123,6 @@ export interface IntelligenceQuickActions {
|
|
|
170
123
|
onReportSpam?: () => void;
|
|
171
124
|
}
|
|
172
125
|
|
|
173
|
-
/**
|
|
174
|
-
* State of the similar-messages section. The host computes these from the
|
|
175
|
-
* semantic-search query so the panel can show a skeleton while in flight and
|
|
176
|
-
* "similarity search unavailable" on failure (the rest of the sidebar still
|
|
177
|
-
* renders). Defaults to "ready" when omitted.
|
|
178
|
-
*
|
|
179
|
-
* "off" is not a failure and not a slow query: this instance stores no message
|
|
180
|
-
* vectors, and it says so with the command that changes it. Without it the
|
|
181
|
-
* section renders nothing at all, which reads as a sender nothing resembles.
|
|
182
|
-
*/
|
|
183
|
-
export type SimilarState = "loading" | "error" | "off" | "ready";
|
|
184
|
-
|
|
185
126
|
/**
|
|
186
127
|
* The two halves of the panel. Sender is what this message is; Calendar is what
|
|
187
128
|
* it would cost. They are tabs rather than one long column because the second
|
|
@@ -211,17 +152,8 @@ export interface IntelligenceCalendarSurface {
|
|
|
211
152
|
export interface IntelligencePanelProps {
|
|
212
153
|
data: IntelligenceData;
|
|
213
154
|
onClose?: () => void;
|
|
214
|
-
onShowSimilar?: () => void;
|
|
215
155
|
/** Quick-action callbacks. When omitted the buttons are visual-only. */
|
|
216
156
|
actions?: IntelligenceQuickActions;
|
|
217
|
-
/** Loading/error state for the similar-messages section. */
|
|
218
|
-
similarState?: SimilarState;
|
|
219
|
-
/**
|
|
220
|
-
* Render-prop that wraps each similar-message row in a real router anchor so
|
|
221
|
-
* it opens that email (deep-link / middle-click / link a11y). When omitted the
|
|
222
|
-
* rows render as static, non-navigating elements (stories / SSR previews).
|
|
223
|
-
*/
|
|
224
|
-
similarLinkComponent?: SimilarMessageLinkComponent;
|
|
225
157
|
/** Layout overrides (e.g. when hosted inside a resizable panel). */
|
|
226
158
|
className?: string;
|
|
227
159
|
/**
|
|
@@ -306,13 +238,7 @@ function SenderCard({ sender }: { sender: SenderIntel }) {
|
|
|
306
238
|
);
|
|
307
239
|
}
|
|
308
240
|
|
|
309
|
-
function Authenticity({
|
|
310
|
-
auth,
|
|
311
|
-
onShowSimilar,
|
|
312
|
-
}: {
|
|
313
|
-
auth: AuthenticityIntel;
|
|
314
|
-
onShowSimilar?: () => void;
|
|
315
|
-
}) {
|
|
241
|
+
function Authenticity({ auth }: { auth: AuthenticityIntel }) {
|
|
316
242
|
if (auth.verdict === "aligned") {
|
|
317
243
|
return (
|
|
318
244
|
<div className="flex items-start gap-2 text-xs text-fg-muted">
|
|
@@ -353,16 +279,6 @@ function Authenticity({
|
|
|
353
279
|
)}
|
|
354
280
|
</div>
|
|
355
281
|
</div>
|
|
356
|
-
{auth.similarCount != null && auth.similarCount > 0 && (
|
|
357
|
-
<Button
|
|
358
|
-
variant="secondary"
|
|
359
|
-
size="sm"
|
|
360
|
-
className="mt-2 w-full border-danger/30 text-danger hover:bg-danger-soft"
|
|
361
|
-
onClick={onShowSimilar}
|
|
362
|
-
>
|
|
363
|
-
{auth.similarCount} similar messages
|
|
364
|
-
</Button>
|
|
365
|
-
)}
|
|
366
282
|
</div>
|
|
367
283
|
);
|
|
368
284
|
}
|
|
@@ -408,22 +324,10 @@ function QuickAction({
|
|
|
408
324
|
);
|
|
409
325
|
}
|
|
410
326
|
|
|
411
|
-
const matchTone: Record<MatchedChunk, string> = {
|
|
412
|
-
sender: "matched: sender",
|
|
413
|
-
recipient: "matched: recipient",
|
|
414
|
-
subject: "matched: subject",
|
|
415
|
-
attachment: "matched: attachment",
|
|
416
|
-
body: "matched: body",
|
|
417
|
-
entities: "matched: entities",
|
|
418
|
-
};
|
|
419
|
-
|
|
420
327
|
export function IntelligencePanel({
|
|
421
328
|
data,
|
|
422
329
|
onClose,
|
|
423
|
-
onShowSimilar,
|
|
424
330
|
actions,
|
|
425
|
-
similarState = "ready",
|
|
426
|
-
similarLinkComponent,
|
|
427
331
|
className,
|
|
428
332
|
hideCloseButton = false,
|
|
429
333
|
reportSpamPending = false,
|
|
@@ -434,7 +338,7 @@ export function IntelligencePanel({
|
|
|
434
338
|
defaultTab = "sender",
|
|
435
339
|
touch,
|
|
436
340
|
}: IntelligencePanelProps) {
|
|
437
|
-
const { sender, authenticity, category, flags = {}
|
|
341
|
+
const { sender, authenticity, category, flags = {} } = data;
|
|
438
342
|
const [ownTab, setOwnTab] = useState<IntelligenceTabId>(defaultTab);
|
|
439
343
|
const tabStripName = useId();
|
|
440
344
|
const activeTab = tab ?? ownTab;
|
|
@@ -496,7 +400,7 @@ export function IntelligencePanel({
|
|
|
496
400
|
</IntelligenceSection>
|
|
497
401
|
|
|
498
402
|
<IntelligenceSection label="Authenticity">
|
|
499
|
-
<Authenticity auth={authenticity}
|
|
403
|
+
<Authenticity auth={authenticity} />
|
|
500
404
|
</IntelligenceSection>
|
|
501
405
|
|
|
502
406
|
<IntelligenceSection label="Category">
|
|
@@ -562,80 +466,6 @@ export function IntelligencePanel({
|
|
|
562
466
|
)}
|
|
563
467
|
</IntelligenceSection>
|
|
564
468
|
|
|
565
|
-
{(similarState !== "ready" || similar.length > 0) && (
|
|
566
|
-
<IntelligenceSection label="Similar messages">
|
|
567
|
-
{similarState === "loading" ? (
|
|
568
|
-
<div className="animate-pulse space-y-2">
|
|
569
|
-
{Array.from({ length: 3 }).map((_, i) => (
|
|
570
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: list is static, no stable id
|
|
571
|
-
<div key={i} className="space-y-1">
|
|
572
|
-
<div className="h-3 w-3/4 rounded bg-surface-sunken" />
|
|
573
|
-
<div className="h-2.5 w-1/2 rounded bg-surface-sunken" />
|
|
574
|
-
</div>
|
|
575
|
-
))}
|
|
576
|
-
</div>
|
|
577
|
-
) : similarState === "error" ? (
|
|
578
|
-
<p className="text-xs text-fg-subtle">
|
|
579
|
-
Similarity search unavailable
|
|
580
|
-
</p>
|
|
581
|
-
) : similarState === "off" ? (
|
|
582
|
-
<div className="space-y-1.5 text-xs text-fg-subtle">
|
|
583
|
-
<p className="text-fg-muted">{SEMANTIC_OFF_TITLE}</p>
|
|
584
|
-
<p>{SEMANTIC_OFF_BUYS}</p>
|
|
585
|
-
<p>
|
|
586
|
-
Run{" "}
|
|
587
|
-
<code className="rounded bg-surface-sunken px-1 py-px text-2xs text-fg-muted">
|
|
588
|
-
{SEMANTIC_OFF_COMMAND}
|
|
589
|
-
</code>{" "}
|
|
590
|
-
on the server.
|
|
591
|
-
</p>
|
|
592
|
-
</div>
|
|
593
|
-
) : (
|
|
594
|
-
<ul className="-mx-1 space-y-1">
|
|
595
|
-
{similar.map((s) => {
|
|
596
|
-
const rowClass =
|
|
597
|
-
"block w-full rounded-md px-1 py-1 text-left hover:bg-surface-sunken";
|
|
598
|
-
const ariaLabel = `Open message from ${s.fromName || "unknown sender"}: ${s.subject}`;
|
|
599
|
-
const inner = (
|
|
600
|
-
<>
|
|
601
|
-
<div className="flex items-baseline justify-between gap-2">
|
|
602
|
-
<span className="truncate text-xs font-medium text-fg">
|
|
603
|
-
{s.fromName}
|
|
604
|
-
</span>
|
|
605
|
-
<span className="shrink-0 text-2xs text-fg-subtle tabular-nums">
|
|
606
|
-
{s.timeLabel}
|
|
607
|
-
</span>
|
|
608
|
-
</div>
|
|
609
|
-
<div className="truncate text-xs text-fg-muted">
|
|
610
|
-
{s.subject}
|
|
611
|
-
</div>
|
|
612
|
-
<span className="mt-1 inline-block rounded-full bg-surface-sunken px-1.5 py-px text-2xs text-fg-subtle">
|
|
613
|
-
{matchTone[s.matched]}
|
|
614
|
-
</span>
|
|
615
|
-
</>
|
|
616
|
-
);
|
|
617
|
-
return (
|
|
618
|
-
<li key={s.id}>
|
|
619
|
-
{similarLinkComponent ? (
|
|
620
|
-
similarLinkComponent({
|
|
621
|
-
mailboxId: s.mailboxId,
|
|
622
|
-
threadId: s.threadId,
|
|
623
|
-
messageId: s.id,
|
|
624
|
-
className: rowClass,
|
|
625
|
-
ariaLabel,
|
|
626
|
-
children: inner,
|
|
627
|
-
})
|
|
628
|
-
) : (
|
|
629
|
-
<div className={rowClass}>{inner}</div>
|
|
630
|
-
)}
|
|
631
|
-
</li>
|
|
632
|
-
);
|
|
633
|
-
})}
|
|
634
|
-
</ul>
|
|
635
|
-
)}
|
|
636
|
-
</IntelligenceSection>
|
|
637
|
-
)}
|
|
638
|
-
|
|
639
469
|
<IntelligenceSection
|
|
640
470
|
label="Coming soon"
|
|
641
471
|
className="border-b-0 opacity-70"
|
|
@@ -14,11 +14,6 @@ const render = (props: Parameters<typeof IntelligenceToggle>[0]): string =>
|
|
|
14
14
|
renderToString(createElement(IntelligenceToggle, props));
|
|
15
15
|
|
|
16
16
|
describe("IntelligenceToggle", () => {
|
|
17
|
-
it("renders the button when it cannot act", () => {
|
|
18
|
-
const html = render({ enabled: false });
|
|
19
|
-
assert.match(html, /aria-label="Show intelligence sidebar"/);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
17
|
it("disables rather than hides the button when it cannot act", () => {
|
|
23
18
|
const html = render({ enabled: false });
|
|
24
19
|
assert.match(html, /\sdisabled(=""|\s|>)/);
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
buildEmailSrcDoc,
|
|
7
7
|
DARK_OPT_IN_RE,
|
|
8
8
|
generateContentInsetCSS,
|
|
9
|
-
generateFramedEmailBaseCSS,
|
|
10
|
-
generatePlainEmailBaseCSS,
|
|
11
9
|
generateScrollportCSS,
|
|
12
10
|
VIEWPORT_META,
|
|
13
11
|
} from "./email-frame-css.js";
|
|
@@ -47,10 +45,6 @@ const frameStyle = (html: string): string => {
|
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
describe("the frame's box is the app's layout, never the mail's", () => {
|
|
50
|
-
it("takes the width of the box holding it", () => {
|
|
51
|
-
assert.match(frameStyle(SHORT_MAIL), /width:100%/);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
48
|
it("gives mail that cannot fit the same box as mail that can", () => {
|
|
55
49
|
// The whole width policy in one assertion: nothing about the email
|
|
56
50
|
// reaches the element the app has laid out, so no mail can move a box
|
|
@@ -127,117 +121,6 @@ describe("fitScale (a wide mail shrinks to the frame, never grows)", () => {
|
|
|
127
121
|
});
|
|
128
122
|
});
|
|
129
123
|
|
|
130
|
-
describe("generateScrollportCSS (the document holds its own overflow)", () => {
|
|
131
|
-
it("makes the body the scrollport rather than the frame", () => {
|
|
132
|
-
assert.match(generateScrollportCSS(), /body\{overflow-x:auto\}/);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it("stops the body's overflow propagating to the frame's viewport", () => {
|
|
136
|
-
// Overflow on the body becomes the viewport's unless the root claims it
|
|
137
|
-
// first, and a scrolling viewport is the app holding the email's width
|
|
138
|
-
// again.
|
|
139
|
-
assert.match(generateScrollportCSS(), /html\{overflow:hidden\}/);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe("generatePlainEmailBaseCSS (theme tokens pinned)", () => {
|
|
144
|
-
it("injects the light-theme resolved tokens", () => {
|
|
145
|
-
const css = generatePlainEmailBaseCSS(false);
|
|
146
|
-
assert.match(css, /oklch\(0\.3 0\.025 235\)/);
|
|
147
|
-
assert.match(css, /oklch\(0\.55 0\.14 150\)/);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it("injects the dark-theme resolved tokens", () => {
|
|
151
|
-
const css = generatePlainEmailBaseCSS(true);
|
|
152
|
-
assert.match(css, /oklch\(0\.88 0\.02 90\)/);
|
|
153
|
-
assert.match(css, /oklch\(0\.78 0\.16 150\)/);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("grounds the email on the reading pane's own canvas, not a lighter surface", () => {
|
|
157
|
-
// --surface (0.975 / 0.25) would render the mail as a lighter rectangle
|
|
158
|
-
// inside the pane, seam and all. --canvas is the pane itself.
|
|
159
|
-
assert.match(generatePlainEmailBaseCSS(false), /oklch\(0\.96 0\.015 90\)/);
|
|
160
|
-
assert.doesNotMatch(
|
|
161
|
-
generatePlainEmailBaseCSS(false),
|
|
162
|
-
/oklch\(0\.975 0\.012 90\)/,
|
|
163
|
-
);
|
|
164
|
-
assert.match(generatePlainEmailBaseCSS(true), /oklch\(0\.22 0\.025 220\)/);
|
|
165
|
-
assert.doesNotMatch(
|
|
166
|
-
generatePlainEmailBaseCSS(true),
|
|
167
|
-
/oklch\(0\.25 0\.025 220\)/,
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("strips author colors and backgrounds from body descendants only", () => {
|
|
172
|
-
const css = generatePlainEmailBaseCSS(false);
|
|
173
|
-
assert.match(css, /body \*\s*\{[^}]*color:\s*inherit\s*!important/);
|
|
174
|
-
assert.match(
|
|
175
|
-
css,
|
|
176
|
-
/body \*\s*\{[^}]*background-color:\s*transparent\s*!important/,
|
|
177
|
-
);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
describe("generateFramedEmailBaseCSS (K-9 dark strategy)", () => {
|
|
182
|
-
it("light theme renders an author background as authored on white, no invert", () => {
|
|
183
|
-
const css = generateFramedEmailBaseCSS(false, false, true);
|
|
184
|
-
assert.match(css, /background-color:#ffffff/);
|
|
185
|
-
assert.match(css, /color-scheme:light/);
|
|
186
|
-
assert.doesNotMatch(css, /invert/);
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it("dark theme without opt-in smart-inverts an author background into the pane", () => {
|
|
190
|
-
const css = generateFramedEmailBaseCSS(true, false, true);
|
|
191
|
-
assert.match(css, /html\{[^}]*filter:invert\(0\.92\) hue-rotate\(180deg\)/);
|
|
192
|
-
// Media re-inverted back to natural color.
|
|
193
|
-
assert.match(css, /img,picture,video[^{]*\{filter:invert/);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it("dark theme WITH opt-in preserves the author's own dark design (no invert)", () => {
|
|
197
|
-
const css = generateFramedEmailBaseCSS(true, true, true);
|
|
198
|
-
assert.match(css, /color-scheme:dark light/);
|
|
199
|
-
assert.doesNotMatch(css, /invert/);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
describe("generateFramedEmailBaseCSS (mail that brings no ground of its own)", () => {
|
|
204
|
-
it("grounds a light-theme email on the pane's canvas instead of white", () => {
|
|
205
|
-
const css = generateFramedEmailBaseCSS(false, false, false);
|
|
206
|
-
assert.match(css, /background-color:oklch\(0\.96 0\.015 90\)/);
|
|
207
|
-
assert.doesNotMatch(css, /#ffffff/);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("grounds a dark-theme email on the pane's canvas and never inverts it", () => {
|
|
211
|
-
// The invert moves off `html` onto `body`: the author's colours still
|
|
212
|
-
// darken, but a white canvas is never painted for it to turn into a
|
|
213
|
-
// charcoal slab sitting inside the pane.
|
|
214
|
-
const css = generateFramedEmailBaseCSS(true, false, false);
|
|
215
|
-
assert.match(
|
|
216
|
-
css,
|
|
217
|
-
/html\{margin:0;background-color:oklch\(0\.22 0\.025 220\)\}/,
|
|
218
|
-
);
|
|
219
|
-
assert.match(css, /body\{margin:0;filter:invert\(0\.92\)/);
|
|
220
|
-
assert.doesNotMatch(css, /#ffffff/);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("grounds a dark opt-in email on the pane's canvas", () => {
|
|
224
|
-
const css = generateFramedEmailBaseCSS(true, true, false);
|
|
225
|
-
assert.match(css, /background-color:oklch\(0\.22 0\.025 220\)/);
|
|
226
|
-
assert.doesNotMatch(css, /invert/);
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
describe("generateContentInsetCSS (breathing room inside the background)", () => {
|
|
231
|
-
it("pads the element that carries the background, in its border box", () => {
|
|
232
|
-
const css = generateContentInsetCSS();
|
|
233
|
-
assert.match(css, /body\{padding:16px;box-sizing:border-box\}/);
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it("leaves the document itself unpadded so the ground reaches the frame edge", () => {
|
|
237
|
-
assert.match(generateContentInsetCSS(), /html\{padding:0\}/);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
124
|
describe("DARK_OPT_IN_RE", () => {
|
|
242
125
|
it("detects color-scheme: dark and prefers-color-scheme: dark", () => {
|
|
243
126
|
assert.ok(DARK_OPT_IN_RE.test(":root{color-scheme: dark}"));
|
|
@@ -276,11 +159,6 @@ describe("buildEmailSrcDoc", () => {
|
|
|
276
159
|
}
|
|
277
160
|
});
|
|
278
161
|
|
|
279
|
-
it("uses the plain base CSS for the plain variant", () => {
|
|
280
|
-
const doc = buildEmailSrcDoc("<p>x</p>", "plain", false);
|
|
281
|
-
assert.match(doc, /Plain-email base/);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
162
|
it("uses the framed smart-invert in dark mode for a non-opt-in framed email", () => {
|
|
285
163
|
const doc = buildEmailSrcDoc("<p>x</p>", "framed", true, {
|
|
286
164
|
background: true,
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DragGesture } from "@use-gesture/vanilla";
|
|
2
|
+
import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { SWIPE_DRAG_CONFIG } from "../lib/swipe-config.js";
|
|
4
|
+
import {
|
|
5
|
+
isZoomed,
|
|
6
|
+
releasedSwipe,
|
|
7
|
+
SWIPE_EVENT,
|
|
8
|
+
SwipeSurface,
|
|
9
|
+
subscribeToZoom,
|
|
10
|
+
} from "../lib/use-swipe-navigation.js";
|
|
2
11
|
import {
|
|
3
12
|
type AuthorDeclarations,
|
|
4
13
|
buildEmailSrcDoc,
|
|
@@ -156,7 +165,7 @@ export const isForwardableKey = (key: string): boolean => {
|
|
|
156
165
|
};
|
|
157
166
|
|
|
158
167
|
/**
|
|
159
|
-
* Keydown events raised inside an iframe never reach the
|
|
168
|
+
* Keydown events raised inside an iframe never reach the parent window, so
|
|
160
169
|
* once the reader clicks into the message body every app shortcut goes dead —
|
|
161
170
|
* j/k, arrows, Esc, the lot (#43). Replay the allowlisted keystrokes on the host
|
|
162
171
|
* window so the app's one keyboard layer keeps hearing them. The replay is a
|
|
@@ -207,6 +216,7 @@ export const IsolatedEmailFrame = ({
|
|
|
207
216
|
}: IsolatedEmailFrameProps) => {
|
|
208
217
|
const ref = useRef<HTMLIFrameElement>(null);
|
|
209
218
|
const [height, setHeight] = useState(0);
|
|
219
|
+
const swipeSurface = useContext(SwipeSurface);
|
|
210
220
|
|
|
211
221
|
const srcDoc = useMemo(
|
|
212
222
|
() => buildEmailSrcDoc(html, variant, isDark, declares),
|
|
@@ -220,6 +230,7 @@ export const IsolatedEmailFrame = ({
|
|
|
220
230
|
const measure = () => {
|
|
221
231
|
const doc = iframe.contentDocument;
|
|
222
232
|
if (!doc?.body) return;
|
|
233
|
+
syncTouchAction();
|
|
223
234
|
const root = doc.documentElement;
|
|
224
235
|
const scale = fitToFrame(doc.body);
|
|
225
236
|
const next =
|
|
@@ -243,8 +254,25 @@ export const IsolatedEmailFrame = ({
|
|
|
243
254
|
pendingFrame = requestAnimationFrame(measure);
|
|
244
255
|
};
|
|
245
256
|
|
|
257
|
+
const claimsSideways = (doc: Document): boolean => {
|
|
258
|
+
const root = doc.documentElement;
|
|
259
|
+
return isZoomed() || root.scrollWidth > root.clientWidth + 1;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const syncTouchAction = () => {
|
|
263
|
+
const doc = iframe.contentDocument;
|
|
264
|
+
if (!swipeSurface || !doc?.body) return;
|
|
265
|
+
const touchAction = claimsSideways(doc) ? "auto" : "pan-y pinch-zoom";
|
|
266
|
+
doc.documentElement.style.touchAction = touchAction;
|
|
267
|
+
doc.body.style.touchAction = touchAction;
|
|
268
|
+
};
|
|
269
|
+
|
|
246
270
|
let observer: ResizeObserver | undefined;
|
|
247
271
|
let keyDoc: Document | undefined;
|
|
272
|
+
let gesture: DragGesture | undefined;
|
|
273
|
+
const unsubscribeZoom = swipeSurface
|
|
274
|
+
? subscribeToZoom(syncTouchAction)
|
|
275
|
+
: undefined;
|
|
248
276
|
const handleLoad = () => {
|
|
249
277
|
measure();
|
|
250
278
|
// The srcDoc is rebuilt whenever the mail, theme or treatment changes,
|
|
@@ -255,8 +283,30 @@ export const IsolatedEmailFrame = ({
|
|
|
255
283
|
keyDoc?.removeEventListener("keydown", forwardKeyDown);
|
|
256
284
|
keyDoc?.removeEventListener("load", measure, true);
|
|
257
285
|
keyDoc = undefined;
|
|
286
|
+
gesture?.destroy();
|
|
287
|
+
gesture = undefined;
|
|
258
288
|
const doc = iframe.contentDocument;
|
|
259
289
|
if (!doc?.body) return;
|
|
290
|
+
syncTouchAction();
|
|
291
|
+
if (swipeSurface)
|
|
292
|
+
gesture = new DragGesture(
|
|
293
|
+
doc.documentElement,
|
|
294
|
+
(state) => {
|
|
295
|
+
const direction = releasedSwipe(state);
|
|
296
|
+
if (!direction) return;
|
|
297
|
+
iframe.dispatchEvent(
|
|
298
|
+
new CustomEvent(SWIPE_EVENT, {
|
|
299
|
+
bubbles: true,
|
|
300
|
+
detail: direction,
|
|
301
|
+
}),
|
|
302
|
+
);
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
...SWIPE_DRAG_CONFIG,
|
|
306
|
+
axis: "x",
|
|
307
|
+
window: doc.defaultView ?? undefined,
|
|
308
|
+
},
|
|
309
|
+
);
|
|
260
310
|
observer = new ResizeObserver(measureNextFrame);
|
|
261
311
|
observer.observe(doc.body);
|
|
262
312
|
if (doc.documentElement) observer.observe(doc.documentElement);
|
|
@@ -278,9 +328,11 @@ export const IsolatedEmailFrame = ({
|
|
|
278
328
|
keyDoc?.removeEventListener("keydown", forwardKeyDown);
|
|
279
329
|
keyDoc?.removeEventListener("load", measure, true);
|
|
280
330
|
observer?.disconnect();
|
|
331
|
+
gesture?.destroy();
|
|
332
|
+
unsubscribeZoom?.();
|
|
281
333
|
cancelAnimationFrame(pendingFrame);
|
|
282
334
|
};
|
|
283
|
-
}, []);
|
|
335
|
+
}, [swipeSurface]);
|
|
284
336
|
|
|
285
337
|
return (
|
|
286
338
|
<iframe
|
|
@@ -6,13 +6,6 @@ import { keyboardHintsFor } from "../lib/keymap.js";
|
|
|
6
6
|
import { KeyboardHintBar } from "./keyboard-hint-bar.js";
|
|
7
7
|
|
|
8
8
|
describe("KeyboardHintBar", () => {
|
|
9
|
-
it("offers the app's own set by default", () => {
|
|
10
|
-
const html = renderToString(createElement(KeyboardHintBar));
|
|
11
|
-
assert.match(html, /<span>navigate<\/span>/);
|
|
12
|
-
assert.match(html, /<span>mute<\/span>/);
|
|
13
|
-
assert.match(html, /<span>all shortcuts<\/span>/);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
9
|
it("offers only what the host's handlers answer", () => {
|
|
17
10
|
const hints = keyboardHintsFor({ focusNext: () => undefined });
|
|
18
11
|
const html = renderToString(createElement(KeyboardHintBar, { hints }));
|
|
@@ -5,34 +5,6 @@ import { renderToString } from "react-dom/server";
|
|
|
5
5
|
import { LabelChip } from "./label-chip.js";
|
|
6
6
|
|
|
7
7
|
describe("LabelChip", () => {
|
|
8
|
-
it("renders the label's name and a dot in its color", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(LabelChip, {
|
|
11
|
-
label: { labelId: "l1", name: "Receipts", color: "Blue" },
|
|
12
|
-
}),
|
|
13
|
-
);
|
|
14
|
-
assert.match(html, /Receipts/);
|
|
15
|
-
assert.match(html, /bg-blue-500/);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("falls back to the neutral dot for an unrecognized color", () => {
|
|
19
|
-
const html = renderToString(
|
|
20
|
-
createElement(LabelChip, {
|
|
21
|
-
label: { labelId: "l1", name: "Mystery", color: "Chartreuse" },
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
24
|
-
assert.match(html, /bg-fg-subtle/);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("renders no remove affordance without onRemove", () => {
|
|
28
|
-
const html = renderToString(
|
|
29
|
-
createElement(LabelChip, {
|
|
30
|
-
label: { labelId: "l1", name: "Receipts", color: "Blue" },
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
33
|
-
assert.doesNotMatch(html, /Remove label/);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
8
|
it("renders a remove button naming the label when onRemove is wired", () => {
|
|
37
9
|
const html = renderToString(
|
|
38
10
|
createElement(LabelChip, {
|
|
@@ -16,7 +16,7 @@ export interface LabelChipProps {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A label applied to a message (issue #26) — a colored dot plus its name, the
|
|
19
|
-
* same shape a category badge
|
|
19
|
+
* same shape a category badge takes. `color` renders from
|
|
20
20
|
* the literal palette (never a semantic tone): a label's color is a user
|
|
21
21
|
* choice, not a status the design system assigns meaning to.
|
|
22
22
|
*/
|
|
@@ -39,15 +39,6 @@ describe("MailHeader", () => {
|
|
|
39
39
|
assert.doesNotMatch(render({ isDesktop: true }), /aria-label="Menu"/);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it("sits on the pane-header datum once the top bar carries search", () => {
|
|
43
|
-
assert.match(render({ showSearch: false }), /h-pane-header/);
|
|
44
|
-
assert.match(render(), /h-section-row/);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("does not render an account chip row (accounts live in the filter / nav)", () => {
|
|
48
|
-
assert.doesNotMatch(render(), /aria-label="Filters"/);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
42
|
it("shows the search magnifier and hides the input when collapsed", () => {
|
|
52
43
|
const html = render({ searchOpen: false });
|
|
53
44
|
assert.match(html, /aria-label="Search"/);
|
|
@@ -112,12 +103,6 @@ describe("MailHeader search ownership", () => {
|
|
|
112
103
|
assert.doesNotMatch(html, /aria-label="Search"/);
|
|
113
104
|
});
|
|
114
105
|
|
|
115
|
-
it("keeps the title and unread count when search lives elsewhere", () => {
|
|
116
|
-
const html = render({ isDesktop: true, showSearch: false });
|
|
117
|
-
assert.match(html, /Daily brief/);
|
|
118
|
-
assert.match(html, /15,338 unread/);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
106
|
it("suppresses the field below desktop too, where the takeover owns search", () => {
|
|
122
107
|
assert.equal(
|
|
123
108
|
countSearchInputs(render({ isDesktop: false, showSearch: false })),
|
|
@@ -129,9 +114,4 @@ describe("MailHeader search ownership", () => {
|
|
|
129
114
|
const combined = topBar() + render({ isDesktop: true, showSearch: false });
|
|
130
115
|
assert.equal(countSearchInputs(combined), 1);
|
|
131
116
|
});
|
|
132
|
-
|
|
133
|
-
it("would be two fields if the header kept its own — the premise being guarded", () => {
|
|
134
|
-
const combined = topBar() + render({ isDesktop: true });
|
|
135
|
-
assert.equal(countSearchInputs(combined), 2);
|
|
136
|
-
});
|
|
137
117
|
});
|