@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AlertCircle } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
interface ErrorStateProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
error: unknown;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
variant?: "block" | "inline";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const formatErrorMessage = (error: unknown): string => {
|
|
11
|
+
if (error instanceof Error) return error.message;
|
|
12
|
+
if (typeof error === "string") return error;
|
|
13
|
+
if (
|
|
14
|
+
typeof error === "object" &&
|
|
15
|
+
error !== null &&
|
|
16
|
+
"message" in error &&
|
|
17
|
+
typeof (error as { message: unknown }).message === "string"
|
|
18
|
+
) {
|
|
19
|
+
return (error as { message: string }).message;
|
|
20
|
+
}
|
|
21
|
+
return "An unexpected error occurred";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ErrorState = ({
|
|
25
|
+
title = "Couldn't load content",
|
|
26
|
+
error,
|
|
27
|
+
onRetry,
|
|
28
|
+
variant = "block",
|
|
29
|
+
}: ErrorStateProps) => {
|
|
30
|
+
const message = formatErrorMessage(error);
|
|
31
|
+
|
|
32
|
+
if (variant === "inline") {
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
role="alert"
|
|
36
|
+
className="flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm"
|
|
37
|
+
>
|
|
38
|
+
<AlertCircle
|
|
39
|
+
className="size-4 shrink-0 text-danger mt-0.5"
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
/>
|
|
42
|
+
<div className="flex-1 min-w-0">
|
|
43
|
+
<p className="font-medium text-danger">{title}</p>
|
|
44
|
+
<p className="text-fg-muted mt-0.5 break-words">{message}</p>
|
|
45
|
+
</div>
|
|
46
|
+
{onRetry && (
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
onClick={onRetry}
|
|
50
|
+
className="shrink-0 text-sm font-medium text-accent hover:underline"
|
|
51
|
+
>
|
|
52
|
+
Retry
|
|
53
|
+
</button>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
role="alert"
|
|
62
|
+
className="flex flex-col items-center justify-center gap-3 p-8 text-center"
|
|
63
|
+
>
|
|
64
|
+
<AlertCircle className="size-8 text-danger" aria-hidden="true" />
|
|
65
|
+
<div>
|
|
66
|
+
<p className="font-medium text-danger">{title}</p>
|
|
67
|
+
<p className="text-sm text-fg-muted mt-1 break-words">{message}</p>
|
|
68
|
+
</div>
|
|
69
|
+
{onRetry && (
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={onRetry}
|
|
73
|
+
className="inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors"
|
|
74
|
+
>
|
|
75
|
+
Retry
|
|
76
|
+
</button>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { X } from "lucide-react";
|
|
2
|
+
import { Fragment, useRef } from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { KEY_HINT_GROUPS } from "../lib/keymap.js";
|
|
5
|
+
import { useOverlayScope } from "../lib/overlay-scope.js";
|
|
6
|
+
import { useModalFocus } from "../lib/use-modal-focus.js";
|
|
7
|
+
import { DialogBackdrop } from "./dialog-backdrop.js";
|
|
8
|
+
import { Kbd } from "./kbd.js";
|
|
9
|
+
|
|
10
|
+
interface KeyboardShortcutsModalProps {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `?` help overlay (#429). Renders the full triage key map from the single
|
|
17
|
+
* source of truth (`@remit/ui`'s keymap) using the `Kbd` component, so the
|
|
18
|
+
* displayed bindings can never drift from what the dispatcher actually routes.
|
|
19
|
+
*/
|
|
20
|
+
export const KeyboardShortcutsModal = ({
|
|
21
|
+
isOpen,
|
|
22
|
+
onClose,
|
|
23
|
+
}: KeyboardShortcutsModalProps) => {
|
|
24
|
+
const modalRef = useRef<HTMLDivElement>(null);
|
|
25
|
+
|
|
26
|
+
useOverlayScope({
|
|
27
|
+
id: "shortcuts",
|
|
28
|
+
open: isOpen,
|
|
29
|
+
answers: { back: onClose },
|
|
30
|
+
});
|
|
31
|
+
useModalFocus(modalRef, isOpen);
|
|
32
|
+
|
|
33
|
+
if (!isOpen) return null;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
37
|
+
<DialogBackdrop
|
|
38
|
+
label="Dismiss keyboard shortcuts"
|
|
39
|
+
onDismiss={onClose}
|
|
40
|
+
className="backdrop-blur-sm"
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
{/* Modal */}
|
|
44
|
+
<div
|
|
45
|
+
ref={modalRef}
|
|
46
|
+
role="dialog"
|
|
47
|
+
aria-modal="true"
|
|
48
|
+
aria-label="Keyboard shortcuts"
|
|
49
|
+
tabIndex={-1}
|
|
50
|
+
className={cn(
|
|
51
|
+
"relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto",
|
|
52
|
+
"rounded-lg border border-line bg-surface shadow-lg",
|
|
53
|
+
"p-6",
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
{/* Header */}
|
|
57
|
+
<div className="mb-6 flex items-center justify-between">
|
|
58
|
+
<h2 className="text-lg font-semibold">Keyboard shortcuts</h2>
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
onClick={onClose}
|
|
62
|
+
className="p-1 text-fg-muted transition-colors hover:text-fg"
|
|
63
|
+
aria-label="Close"
|
|
64
|
+
>
|
|
65
|
+
<X className="size-5" />
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{/* Sections — two columns on wider modals */}
|
|
70
|
+
<div className="grid gap-x-8 gap-y-6 sm:grid-cols-2">
|
|
71
|
+
{KEY_HINT_GROUPS.map((group) => (
|
|
72
|
+
<div key={group.title}>
|
|
73
|
+
<h3 className="mb-3 text-sm font-medium text-fg-muted">
|
|
74
|
+
{group.title}
|
|
75
|
+
</h3>
|
|
76
|
+
<div className="space-y-2">
|
|
77
|
+
{group.hints.map((hint) => (
|
|
78
|
+
<div
|
|
79
|
+
key={`${hint.action}-${hint.keys.join("+")}`}
|
|
80
|
+
className="flex items-center justify-between gap-4"
|
|
81
|
+
>
|
|
82
|
+
<span className="text-sm">{hint.description}</span>
|
|
83
|
+
<span className="flex shrink-0 items-center gap-1">
|
|
84
|
+
{hint.keys.map((key, index) => (
|
|
85
|
+
<Fragment key={key}>
|
|
86
|
+
{index > 0 && hint.keys[0] === "g" && (
|
|
87
|
+
<span className="text-2xs text-fg-subtle">
|
|
88
|
+
then
|
|
89
|
+
</span>
|
|
90
|
+
)}
|
|
91
|
+
<Kbd>{key}</Kbd>
|
|
92
|
+
</Fragment>
|
|
93
|
+
))}
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
))}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
{/* Footer */}
|
|
103
|
+
<div className="mt-6 border-t border-line pt-4">
|
|
104
|
+
<p className="text-center text-xs text-fg-muted">
|
|
105
|
+
Press <Kbd>Esc</Kbd> to close
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
@@ -7,49 +7,9 @@
|
|
|
7
7
|
import "@remit/test-dom";
|
|
8
8
|
import assert from "node:assert/strict";
|
|
9
9
|
import { describe, it } from "node:test";
|
|
10
|
-
import {
|
|
11
|
-
import { renderToString } from "react-dom/server";
|
|
12
|
-
import {
|
|
13
|
-
type AccountServiceChange,
|
|
14
|
-
AccountServiceChangeDialog,
|
|
15
|
-
accountServiceChangeCopy,
|
|
16
|
-
} from "./account-service-change-dialog.js";
|
|
17
|
-
|
|
18
|
-
const render = (change: AccountServiceChange | null): string =>
|
|
19
|
-
renderToString(
|
|
20
|
-
createElement(AccountServiceChangeDialog, {
|
|
21
|
-
change,
|
|
22
|
-
providerName: "Microsoft",
|
|
23
|
-
onConfirm: () => {},
|
|
24
|
-
onCancel: () => {},
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
10
|
+
import { accountServiceChangeCopy } from "./account-service-change-dialog.js";
|
|
27
11
|
|
|
28
12
|
describe("AccountServiceChangeDialog", () => {
|
|
29
|
-
it("renders nothing while no change is pending", () => {
|
|
30
|
-
assert.equal(render(null), "");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("promises stored mail stays and says sync stops", () => {
|
|
34
|
-
const html = render({ kind: "disable", service: "Mail" });
|
|
35
|
-
assert.match(html, /Mail already in Remit stays/);
|
|
36
|
-
assert.match(html, /New mail stops arriving until you turn it back on\./);
|
|
37
|
-
assert.match(html, /Nothing is deleted\./);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("promises stored events stay when calendar goes off", () => {
|
|
41
|
-
const html = render({ kind: "disable", service: "Calendar" });
|
|
42
|
-
assert.match(html, /Events already in Remit stay on your calendar\./);
|
|
43
|
-
assert.match(html, /Nothing is deleted\./);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("names the sign-in round trip before a service is added", () => {
|
|
47
|
-
const html = render({ kind: "enable", service: "Calendar" });
|
|
48
|
-
assert.match(html, /Remit sends you to Microsoft to ask for it/);
|
|
49
|
-
assert.match(html, /Nothing changes until you get back\./);
|
|
50
|
-
assert.match(html, /Continue to Microsoft/);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
13
|
it("sends the last service off to removing the account", () => {
|
|
54
14
|
const copy = accountServiceChangeCopy(
|
|
55
15
|
{ kind: "last", service: "Mail" },
|
|
@@ -31,29 +31,11 @@ const render = (props: Partial<AccountServiceChoiceProps> = {}): string =>
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
describe("AccountServiceChoice", () => {
|
|
34
|
-
it("offers mail and calendar, mail first", () => {
|
|
35
|
-
const html = render();
|
|
36
|
-
assert.match(html, /Mail/);
|
|
37
|
-
assert.match(html, /Calendar/);
|
|
38
|
-
assert.ok(html.indexOf("Mail") < html.indexOf("Calendar"));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
34
|
it("ticks the services it is given and leaves the rest clear", () => {
|
|
42
35
|
const html = render({ selected: ["Calendar"] });
|
|
43
36
|
assert.equal(html.match(/checked=""/g)?.length, 1);
|
|
44
37
|
});
|
|
45
38
|
|
|
46
|
-
it("ticks both when both are selected", () => {
|
|
47
|
-
assert.equal(render().match(/checked=""/g)?.length, 2);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("names the provider adding a service sends you back to", () => {
|
|
51
|
-
assert.match(
|
|
52
|
-
render(),
|
|
53
|
-
/Adding a service later means signing in with Microsoft again\./,
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
39
|
it("renders nothing for a provider that only syncs mail", () => {
|
|
58
40
|
assert.equal(render({ offered: ["Mail"], selected: ["Mail"] }), "");
|
|
59
41
|
});
|
|
@@ -69,14 +51,6 @@ describe("AccountServiceChoice", () => {
|
|
|
69
51
|
);
|
|
70
52
|
});
|
|
71
53
|
|
|
72
|
-
it("shows a refusal only when it is given one", () => {
|
|
73
|
-
assert.doesNotMatch(render({ selected: [] }), /Pick at least one/);
|
|
74
|
-
assert.match(
|
|
75
|
-
render({ selected: [], error: ACCOUNT_SERVICE_EMPTY_MESSAGE }),
|
|
76
|
-
/Pick at least one/,
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
54
|
it("announces the refusal", () => {
|
|
81
55
|
assert.match(
|
|
82
56
|
render({ selected: [], error: ACCOUNT_SERVICE_EMPTY_MESSAGE }),
|
|
@@ -74,12 +74,6 @@ function pressSwitch(
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
describe("AccountServiceToggles", () => {
|
|
77
|
-
it("offers a switch per service, mail first", () => {
|
|
78
|
-
const html = render();
|
|
79
|
-
assert.equal(html.match(/role="switch"/g)?.length, 2);
|
|
80
|
-
assert.ok(html.indexOf("Mail") < html.indexOf("Calendar"));
|
|
81
|
-
});
|
|
82
|
-
|
|
83
77
|
it("shows each switch in the state the account is in", () => {
|
|
84
78
|
const html = render({ enabled: ["Calendar"] });
|
|
85
79
|
assert.equal(html.match(/aria-checked="true"/g)?.length, 1);
|
|
@@ -2,11 +2,7 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import { renderToString } from "react-dom/server";
|
|
5
|
-
import {
|
|
6
|
-
AddressDisplay,
|
|
7
|
-
AddressList,
|
|
8
|
-
type EnvelopeAddress,
|
|
9
|
-
} from "./address-display.js";
|
|
5
|
+
import { AddressList, type EnvelopeAddress } from "./address-display.js";
|
|
10
6
|
|
|
11
7
|
const named: EnvelopeAddress = {
|
|
12
8
|
displayName: "Ada Lovelace",
|
|
@@ -14,39 +10,6 @@ const named: EnvelopeAddress = {
|
|
|
14
10
|
};
|
|
15
11
|
const bare: EnvelopeAddress = { normalizedEmail: "grace@example.com" };
|
|
16
12
|
|
|
17
|
-
describe("AddressDisplay", () => {
|
|
18
|
-
it("renders display name with the address in angle brackets", () => {
|
|
19
|
-
const html = renderToString(
|
|
20
|
-
createElement(AddressDisplay, { address: named }),
|
|
21
|
-
);
|
|
22
|
-
assert.match(html, /Ada Lovelace/);
|
|
23
|
-
assert.match(html, /ada@example.com/);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("falls back to the bare email when no display name", () => {
|
|
27
|
-
const html = renderToString(
|
|
28
|
-
createElement(AddressDisplay, { address: bare }),
|
|
29
|
-
);
|
|
30
|
-
assert.match(html, /grace@example.com/);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("shows the trusted badge only when asked", () => {
|
|
34
|
-
assert.match(
|
|
35
|
-
renderToString(
|
|
36
|
-
createElement(AddressDisplay, {
|
|
37
|
-
address: named,
|
|
38
|
-
showTrustedBadge: true,
|
|
39
|
-
}),
|
|
40
|
-
),
|
|
41
|
-
/data-testid="trusted-sender-badge"/,
|
|
42
|
-
);
|
|
43
|
-
assert.doesNotMatch(
|
|
44
|
-
renderToString(createElement(AddressDisplay, { address: named })),
|
|
45
|
-
/trusted-sender-badge/,
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
13
|
describe("AddressList", () => {
|
|
51
14
|
it("renders nothing for an empty list", () => {
|
|
52
15
|
assert.equal(
|
|
@@ -5,17 +5,6 @@ import { renderToString } from "react-dom/server";
|
|
|
5
5
|
import { AddressTag } from "./address-tag.js";
|
|
6
6
|
|
|
7
7
|
describe("AddressTag", () => {
|
|
8
|
-
it("renders the display name when present", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(AddressTag, {
|
|
11
|
-
email: "alex@example.com",
|
|
12
|
-
displayName: "Alex Rivera",
|
|
13
|
-
onRemove: () => {},
|
|
14
|
-
}),
|
|
15
|
-
);
|
|
16
|
-
assert.match(html, /Alex Rivera/);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
8
|
it("falls back to the bare address when no display name", () => {
|
|
20
9
|
const html = renderToString(
|
|
21
10
|
createElement(AddressTag, {
|
|
@@ -364,14 +364,6 @@ describe("the end of what the strip grows to on its own", () => {
|
|
|
364
364
|
assert.equal(asked, 1);
|
|
365
365
|
});
|
|
366
366
|
|
|
367
|
-
it("offers the days behind the same way", () => {
|
|
368
|
-
render({ atStartCap: true, onLoadEarlier: () => {} });
|
|
369
|
-
const earlier = container.querySelector(
|
|
370
|
-
'[data-testid="agenda-load-earlier"]',
|
|
371
|
-
);
|
|
372
|
-
assert.ok(earlier, "the strip offered the days before the cap");
|
|
373
|
-
});
|
|
374
|
-
|
|
375
367
|
it("shows neither while the run still has room to grow", () => {
|
|
376
368
|
render();
|
|
377
369
|
assert.equal(
|
|
@@ -121,14 +121,6 @@ const render = (props: Partial<AgendaFlowProps> = {}) =>
|
|
|
121
121
|
renderToString(createElement(AgendaFlow, { ...base, ...props }));
|
|
122
122
|
|
|
123
123
|
describe("AgendaFlow", () => {
|
|
124
|
-
it("draws the days in the order it was handed them", () => {
|
|
125
|
-
const html = render();
|
|
126
|
-
assert.ok(
|
|
127
|
-
html.indexOf("Q3 roadmap review") < html.indexOf("Devcon"),
|
|
128
|
-
"the 10th is drawn before the 11th",
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
124
|
it("names the free stretch the day still leaves open", () => {
|
|
133
125
|
const html = words(render());
|
|
134
126
|
assert.match(html, /10h free/);
|
|
@@ -167,14 +159,6 @@ describe("AgendaFlow", () => {
|
|
|
167
159
|
assert.match(render(), /2 events · 2h booked · 1 clash/);
|
|
168
160
|
});
|
|
169
161
|
|
|
170
|
-
it("carries the calendar's hue onto every event", () => {
|
|
171
|
-
assert.match(render(), /bg-cal-3-soft/);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it("falls back to one hue for a calendar it was told nothing about", () => {
|
|
175
|
-
assert.match(render({ calendars: [] }), /bg-cal-1-soft/);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
162
|
it("draws a banner as an all-day line", () => {
|
|
179
163
|
assert.match(render(), /All day/);
|
|
180
164
|
});
|
|
@@ -203,14 +187,6 @@ describe("AgendaFlow", () => {
|
|
|
203
187
|
assert.match(html, /clear/);
|
|
204
188
|
});
|
|
205
189
|
|
|
206
|
-
it("gives every control a visible focus ring", () => {
|
|
207
|
-
assert.match(render(), /focus-visible:ring-ring/);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("grows every hit target when the surface is touched", () => {
|
|
211
|
-
assert.match(render({ touch: true }), /min-h-12/);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
190
|
/**
|
|
215
191
|
* Busy time on a calendar the strip is not drawing still takes the afternoon.
|
|
216
192
|
* Without this, a reader who unticks work reads "Free all day" for a day they
|
|
@@ -249,11 +225,4 @@ describe("AgendaFlow", () => {
|
|
|
249
225
|
const html = words(render({ loadingDates: new Set(["2026-06-13"]) }));
|
|
250
226
|
assert.match(html, /Loading 2026-06-13/);
|
|
251
227
|
});
|
|
252
|
-
|
|
253
|
-
it("renders whatever the owner leads today with", () => {
|
|
254
|
-
const html = render({
|
|
255
|
-
todayLead: createElement("p", null, "Next up in 30m"),
|
|
256
|
-
});
|
|
257
|
-
assert.match(html, /Next up in 30m/);
|
|
258
|
-
});
|
|
259
228
|
});
|
|
@@ -129,9 +129,4 @@ describe("NextUpCard", () => {
|
|
|
129
129
|
});
|
|
130
130
|
assert.match(html, /Nothing else booked\./);
|
|
131
131
|
});
|
|
132
|
-
|
|
133
|
-
it("carries the calendar's hue and falls back when it has none", () => {
|
|
134
|
-
assert.match(renderNextUp(), /bg-cal-3-soft/);
|
|
135
|
-
assert.match(renderNextUp({ calendars: [] }), /bg-cal-1-soft/);
|
|
136
|
-
});
|
|
137
132
|
});
|
|
@@ -19,23 +19,6 @@ const listSize = (html: string) =>
|
|
|
19
19
|
html.match(/data-panel-id="list" data-panel-size="([\d.]+)"/)?.[1];
|
|
20
20
|
|
|
21
21
|
describe("AppShellSlotted slot rendering", () => {
|
|
22
|
-
it("renders the list slot unconditionally", () => {
|
|
23
|
-
const html = render({ initialWidth: 800 });
|
|
24
|
-
assert.match(html, /data-testid="list"/, "list slot is always rendered");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("renders the reading slot at/above 1024px", () => {
|
|
28
|
-
const html = render({
|
|
29
|
-
initialWidth: 1100,
|
|
30
|
-
reading: createElement("div", { "data-testid": "reading" }, "Reading"),
|
|
31
|
-
});
|
|
32
|
-
assert.match(
|
|
33
|
-
html,
|
|
34
|
-
/data-testid="reading"/,
|
|
35
|
-
"reading pane appears at 1024px",
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
22
|
it("hides the reading slot below 1024px", () => {
|
|
40
23
|
const html = render({
|
|
41
24
|
initialWidth: 800,
|
|
@@ -84,77 +67,6 @@ describe("AppShellSlotted slot rendering", () => {
|
|
|
84
67
|
);
|
|
85
68
|
});
|
|
86
69
|
|
|
87
|
-
it("splits the list and reading panes 33/67 by default", () => {
|
|
88
|
-
assert.equal(
|
|
89
|
-
listSize(
|
|
90
|
-
render({
|
|
91
|
-
initialWidth: 1100,
|
|
92
|
-
reading: createElement(
|
|
93
|
-
"div",
|
|
94
|
-
{ "data-testid": "reading" },
|
|
95
|
-
"Reading",
|
|
96
|
-
),
|
|
97
|
-
}),
|
|
98
|
-
),
|
|
99
|
-
"33.0",
|
|
100
|
-
"the list keeps its standard third",
|
|
101
|
-
);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("widens the list default at compact density", () => {
|
|
105
|
-
assert.equal(
|
|
106
|
-
listSize(
|
|
107
|
-
render({
|
|
108
|
-
initialWidth: 1100,
|
|
109
|
-
density: "compact",
|
|
110
|
-
reading: createElement(
|
|
111
|
-
"div",
|
|
112
|
-
{ "data-testid": "reading" },
|
|
113
|
-
"Reading",
|
|
114
|
-
),
|
|
115
|
-
}),
|
|
116
|
-
),
|
|
117
|
-
"43.0",
|
|
118
|
-
"denser rows read better with more room",
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("gives the list the larger share when the bias is on it", () => {
|
|
123
|
-
assert.equal(
|
|
124
|
-
listSize(
|
|
125
|
-
render({
|
|
126
|
-
initialWidth: 1100,
|
|
127
|
-
listBias: "list",
|
|
128
|
-
reading: createElement(
|
|
129
|
-
"div",
|
|
130
|
-
{ "data-testid": "reading" },
|
|
131
|
-
"Reading",
|
|
132
|
-
),
|
|
133
|
-
}),
|
|
134
|
-
),
|
|
135
|
-
"62.0",
|
|
136
|
-
"a list that is the work keeps the width",
|
|
137
|
-
);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("gives the list the smaller share when the bias is on the detail", () => {
|
|
141
|
-
assert.equal(
|
|
142
|
-
listSize(
|
|
143
|
-
render({
|
|
144
|
-
initialWidth: 1100,
|
|
145
|
-
listBias: "detail",
|
|
146
|
-
reading: createElement(
|
|
147
|
-
"div",
|
|
148
|
-
{ "data-testid": "reading" },
|
|
149
|
-
"Reading",
|
|
150
|
-
),
|
|
151
|
-
}),
|
|
152
|
-
),
|
|
153
|
-
"26.0",
|
|
154
|
-
"a spine of a list gets a spine's width",
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
70
|
it("ignores the bias when there is no reading pane to split with", () => {
|
|
159
71
|
assert.equal(
|
|
160
72
|
listSize(render({ initialWidth: 1100, listBias: "list" })),
|
|
@@ -163,11 +75,6 @@ describe("AppShellSlotted slot rendering", () => {
|
|
|
163
75
|
);
|
|
164
76
|
});
|
|
165
77
|
|
|
166
|
-
it("renders the nav as a pane at/above 1024px (no folders trigger)", () => {
|
|
167
|
-
const html = render({ initialWidth: 1100 });
|
|
168
|
-
assert.match(html, /data-testid="nav"/, "nav is in the pane");
|
|
169
|
-
});
|
|
170
|
-
|
|
171
78
|
it("shows the header slot only below 1024px", () => {
|
|
172
79
|
const headerEl = createElement(
|
|
173
80
|
"div",
|
|
@@ -205,23 +112,6 @@ describe("AppShellSlotted slot rendering", () => {
|
|
|
205
112
|
}
|
|
206
113
|
});
|
|
207
114
|
|
|
208
|
-
it("spans the top bar over the nav column too", () => {
|
|
209
|
-
const html = render({
|
|
210
|
-
initialWidth: 1400,
|
|
211
|
-
topBar: createElement("div", { "data-testid": "topbar" }, "Bar"),
|
|
212
|
-
reading: createElement("div", { "data-testid": "reading" }, "Reading"),
|
|
213
|
-
});
|
|
214
|
-
assert.ok(
|
|
215
|
-
html.indexOf('data-testid="topbar"') < html.indexOf('data-testid="nav"'),
|
|
216
|
-
"the bar opens the layout, so it runs the full width",
|
|
217
|
-
);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it("omits the top bar when the caller passes none", () => {
|
|
221
|
-
const html = render({ initialWidth: 1100 });
|
|
222
|
-
assert.doesNotMatch(html, /data-testid="topbar"/);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
115
|
it("hides the top bar with the rest of the layout while loading", () => {
|
|
226
116
|
const html = render({
|
|
227
117
|
isLoading: true,
|
|
@@ -231,14 +121,6 @@ describe("AppShellSlotted slot rendering", () => {
|
|
|
231
121
|
assert.doesNotMatch(html, /data-testid="topbar"/);
|
|
232
122
|
});
|
|
233
123
|
|
|
234
|
-
it("renders the overlay regardless of width", () => {
|
|
235
|
-
const overlayEl = createElement("div", { "data-testid": "overlay" }, "FAB");
|
|
236
|
-
const narrowHtml = render({ initialWidth: 800, overlay: overlayEl });
|
|
237
|
-
const wideHtml = render({ initialWidth: 1100, overlay: overlayEl });
|
|
238
|
-
assert.match(narrowHtml, /data-testid="overlay"/, "overlay on narrow");
|
|
239
|
-
assert.match(wideHtml, /data-testid="overlay"/, "overlay on desktop");
|
|
240
|
-
});
|
|
241
|
-
|
|
242
124
|
it("renders the skeleton when isLoading is true", () => {
|
|
243
125
|
const html = render({
|
|
244
126
|
isLoading: true,
|