@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.
- package/package.json +12 -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 +1 -1
- 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-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 +0 -15
- package/src/components/swipeable-row.render.test.ts +0 -7
- 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 -30
- 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/use-list-cursor.test.ts +0 -7
- package/src/lib/use-list-keyboard.test.ts +0 -14
- 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/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
|
@@ -1,67 +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
|
-
CalendarEventChip,
|
|
7
|
-
type CalendarEventChipProps,
|
|
8
|
-
} from "./calendar-event-chip.js";
|
|
9
|
-
|
|
10
|
-
const base: CalendarEventChipProps = {
|
|
11
|
-
title: "Q3 roadmap review",
|
|
12
|
-
timeText: "10:00",
|
|
13
|
-
color: "cal-1",
|
|
14
|
-
layout: "row",
|
|
15
|
-
density: "comfortable",
|
|
16
|
-
rsvp: "accepted",
|
|
17
|
-
status: "confirmed",
|
|
18
|
-
hasThread: false,
|
|
19
|
-
isRecurring: false,
|
|
20
|
-
zoneCertainty: "local",
|
|
21
|
-
selected: false,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const render = (props: Partial<CalendarEventChipProps>) =>
|
|
25
|
-
renderToString(createElement(CalendarEventChip, { ...base, ...props }));
|
|
26
|
-
|
|
27
|
-
describe("CalendarEventChip", () => {
|
|
28
|
-
it("carries the calendar's hue and nothing else coloured", () => {
|
|
29
|
-
const html = render({ color: "cal-3" });
|
|
30
|
-
assert.match(html, /bg-cal-3-soft/);
|
|
31
|
-
assert.match(html, /text-cal-3/);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("renders the time ahead of the title", () => {
|
|
35
|
-
const html = render({});
|
|
36
|
-
assert.match(html, /10:00/);
|
|
37
|
-
assert.match(html, /Q3 roadmap review/);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("omits the time for an all-day entry", () => {
|
|
41
|
-
const html = render({ timeText: "" });
|
|
42
|
-
assert.doesNotMatch(html, /tabular-nums/);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("strikes a declined event rather than recolouring it", () => {
|
|
46
|
-
const html = render({ rsvp: "declined" });
|
|
47
|
-
assert.match(html, /line-through/);
|
|
48
|
-
assert.match(html, /bg-cal-1-soft/);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("dashes the border of a tentative event", () => {
|
|
52
|
-
const html = render({ status: "tentative" });
|
|
53
|
-
assert.match(html, /border-dashed/);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("marks an event that came from mail", () => {
|
|
57
|
-
assert.match(render({ hasThread: true }), /From mail/);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("marks a repeating event", () => {
|
|
61
|
-
assert.match(render({ isRecurring: true }), /Repeats/);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("flags a zone it could not determine", () => {
|
|
65
|
-
assert.match(render({ zoneCertainty: "ambiguous" }), /Unclear zone/);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,40 +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
|
-
CalendarParseBadge,
|
|
7
|
-
calendarParseLabel,
|
|
8
|
-
calendarParseNote,
|
|
9
|
-
} from "./calendar-parse-badge.js";
|
|
10
|
-
import type { CalendarParseMethod } from "./calendar-types.js";
|
|
11
|
-
|
|
12
|
-
const methods: CalendarParseMethod[] = ["ics", "markup", "pattern"];
|
|
13
|
-
|
|
14
|
-
const render = (method: CalendarParseMethod) =>
|
|
15
|
-
renderToString(createElement(CalendarParseBadge, { method }));
|
|
16
|
-
|
|
17
|
-
describe("CalendarParseBadge", () => {
|
|
18
|
-
it("names the rung that answered", () => {
|
|
19
|
-
for (const method of methods) {
|
|
20
|
-
assert.match(render(method), new RegExp(calendarParseLabel[method]));
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("marks a stated field apart from a reading of the prose", () => {
|
|
25
|
-
assert.match(render("ics"), /text-positive/);
|
|
26
|
-
assert.match(render("pattern"), /text-warning/);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("carries a label and a note for every rung", () => {
|
|
30
|
-
for (const method of methods) {
|
|
31
|
-
assert.notEqual(calendarParseLabel[method], undefined, method);
|
|
32
|
-
assert.notEqual(calendarParseNote[method], undefined, method);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("says a prose reading can be wrong, where a copied field does not", () => {
|
|
37
|
-
assert.match(calendarParseNote.pattern, /can be wrong/);
|
|
38
|
-
assert.doesNotMatch(calendarParseNote.ics, /can be wrong/);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,65 +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 { Checkbox } from "./checkbox.js";
|
|
6
|
-
|
|
7
|
-
const noop = () => {};
|
|
8
|
-
|
|
9
|
-
describe("Checkbox", () => {
|
|
10
|
-
it("renders a real checkbox input", () => {
|
|
11
|
-
const html = renderToString(
|
|
12
|
-
createElement(Checkbox, {
|
|
13
|
-
"aria-label": "Select row",
|
|
14
|
-
checked: false,
|
|
15
|
-
onChange: noop,
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
assert.match(html, /type="checkbox"/);
|
|
19
|
-
assert.match(html, /aria-label="Select row"/);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("reflects the checked state on the input", () => {
|
|
23
|
-
const checked = renderToString(
|
|
24
|
-
createElement(Checkbox, {
|
|
25
|
-
"aria-label": "x",
|
|
26
|
-
checked: true,
|
|
27
|
-
onChange: noop,
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
assert.match(checked, /checked=""/);
|
|
31
|
-
|
|
32
|
-
const unchecked = renderToString(
|
|
33
|
-
createElement(Checkbox, {
|
|
34
|
-
"aria-label": "x",
|
|
35
|
-
checked: false,
|
|
36
|
-
onChange: noop,
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
assert.doesNotMatch(unchecked, /checked=""/);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("wraps in a label with the touch target when given label text", () => {
|
|
43
|
-
const html = renderToString(
|
|
44
|
-
createElement(Checkbox, {
|
|
45
|
-
label: "Keep me posted",
|
|
46
|
-
checked: false,
|
|
47
|
-
onChange: noop,
|
|
48
|
-
}),
|
|
49
|
-
);
|
|
50
|
-
assert.match(html, /<label/);
|
|
51
|
-
assert.match(html, /min-h-11/);
|
|
52
|
-
assert.match(html, /Keep me posted/);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("renders just the control when label and description are omitted", () => {
|
|
56
|
-
const html = renderToString(
|
|
57
|
-
createElement(Checkbox, {
|
|
58
|
-
"aria-label": "bare",
|
|
59
|
-
checked: false,
|
|
60
|
-
onChange: noop,
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
63
|
-
assert.doesNotMatch(html, /<label/);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,106 +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 { ComposeFormShell } from "./compose-form-shell.js";
|
|
6
|
-
|
|
7
|
-
describe("ComposeFormShell", () => {
|
|
8
|
-
it("renders header, body and action bar slots in order", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(ComposeFormShell, {
|
|
11
|
-
header: createElement("div", null, "HEADER"),
|
|
12
|
-
actionBar: createElement("div", null, "ACTIONBAR"),
|
|
13
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
14
|
-
children: createElement("div", null, "BODY"),
|
|
15
|
-
}),
|
|
16
|
-
);
|
|
17
|
-
assert.ok(html.indexOf("HEADER") < html.indexOf("BODY"));
|
|
18
|
-
assert.ok(html.indexOf("BODY") < html.indexOf("ACTIONBAR"));
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("renders the banner and quoted slots when supplied", () => {
|
|
22
|
-
const html = renderToString(
|
|
23
|
-
createElement(ComposeFormShell, {
|
|
24
|
-
banner: createElement("div", null, "BANNER"),
|
|
25
|
-
header: createElement("div", null, "HEADER"),
|
|
26
|
-
quoted: createElement("div", null, "QUOTED"),
|
|
27
|
-
actionBar: createElement("div", null, "BAR"),
|
|
28
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
29
|
-
children: createElement("div", null, "BODY"),
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
32
|
-
assert.match(html, /BANNER/);
|
|
33
|
-
assert.match(html, /QUOTED/);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("omits the quoted region when not supplied", () => {
|
|
37
|
-
const html = renderToString(
|
|
38
|
-
createElement(ComposeFormShell, {
|
|
39
|
-
header: createElement("div", null, "H"),
|
|
40
|
-
actionBar: createElement("div", null, "B"),
|
|
41
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
42
|
-
children: createElement("div", null, "BODY"),
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
assert.doesNotMatch(html, /pb-2/);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("scrolls the body region when it fills the height it is given", () => {
|
|
49
|
-
const html = renderToString(
|
|
50
|
-
createElement(ComposeFormShell, {
|
|
51
|
-
layout: "fill",
|
|
52
|
-
header: createElement("div", null, "H"),
|
|
53
|
-
actionBar: createElement("div", null, "B"),
|
|
54
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
55
|
-
children: createElement("div", null, "BODY"),
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
assert.match(html, /overflow-auto/);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("scrolls nothing when it takes the height of what is written in it", () => {
|
|
62
|
-
const html = renderToString(
|
|
63
|
-
createElement(ComposeFormShell, {
|
|
64
|
-
layout: "flow",
|
|
65
|
-
header: createElement("div", null, "H"),
|
|
66
|
-
quoted: createElement("div", null, "QUOTED"),
|
|
67
|
-
actionBar: createElement("div", null, "B"),
|
|
68
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
69
|
-
children: createElement("div", null, "BODY"),
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
-
// A surface opened as a block of a page it did not bring: a scroller here
|
|
73
|
-
// is a second track in that page's column, with the caret inside it.
|
|
74
|
-
assert.doesNotMatch(html, /overflow-/);
|
|
75
|
-
assert.doesNotMatch(html, /h-full/);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("keeps the action bar on the bottom edge while the surface grows", () => {
|
|
79
|
-
const html = renderToString(
|
|
80
|
-
createElement(ComposeFormShell, {
|
|
81
|
-
layout: "flow",
|
|
82
|
-
header: createElement("div", null, "H"),
|
|
83
|
-
actionBar: createElement("div", null, "B"),
|
|
84
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
85
|
-
children: createElement("div", null, "BODY"),
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
// A draft of a few paragraphs is taller than a phone, and the bar is the
|
|
89
|
-
// last thing in the surface: without this Send goes off the bottom as it
|
|
90
|
-
// is written.
|
|
91
|
-
assert.match(html, /sticky bottom-0/);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("leaves the action bar in the column when the surface fills its pane", () => {
|
|
95
|
-
const html = renderToString(
|
|
96
|
-
createElement(ComposeFormShell, {
|
|
97
|
-
layout: "fill",
|
|
98
|
-
header: createElement("div", null, "H"),
|
|
99
|
-
actionBar: createElement("div", null, "B"),
|
|
100
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
101
|
-
children: createElement("div", null, "BODY"),
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
assert.doesNotMatch(html, /sticky/);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1,51 +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 { Dialog } from "./dialog.js";
|
|
6
|
-
|
|
7
|
-
const render = (props: Partial<Parameters<typeof Dialog>[0]>) =>
|
|
8
|
-
renderToString(
|
|
9
|
-
createElement(Dialog, {
|
|
10
|
-
open: true,
|
|
11
|
-
onClose: () => {},
|
|
12
|
-
title: "Folders",
|
|
13
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
14
|
-
children: createElement("span", null, "nav content"),
|
|
15
|
-
...props,
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
describe("Dialog backdrop", () => {
|
|
20
|
-
it("never frosts the content behind it (no blur, just a dim scrim)", () => {
|
|
21
|
-
const center = render({});
|
|
22
|
-
const left = render({ anchor: "left" });
|
|
23
|
-
assert.doesNotMatch(center, /backdrop-blur/, "center modal has no blur");
|
|
24
|
-
assert.doesNotMatch(left, /backdrop-blur/, "left drawer has no blur");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("dims what it covers, at every anchor", () => {
|
|
28
|
-
for (const anchor of ["center", "left", "right"] as const) {
|
|
29
|
-
assert.match(
|
|
30
|
-
render(anchor === "center" ? {} : { anchor }),
|
|
31
|
-
/bg-canvas\/80/,
|
|
32
|
-
`${anchor} dialog dims the content behind it`,
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("right slide-over mirrors left, pinned to the other edge", () => {
|
|
38
|
-
const right = render({ anchor: "right" });
|
|
39
|
-
assert.doesNotMatch(right, /backdrop-blur/, "right drawer has no blur");
|
|
40
|
-
assert.match(right, /justify-end/, "panel is pinned to the right edge");
|
|
41
|
-
assert.match(right, /border-l/, "right drawer has a left hairline");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("renders nothing when closed, so it never covers the content", () => {
|
|
45
|
-
assert.equal(
|
|
46
|
-
render({ open: false }),
|
|
47
|
-
"",
|
|
48
|
-
"closed dialog renders no markup",
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,16 +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 { FieldLabel } from "./field-label.js";
|
|
6
|
-
|
|
7
|
-
describe("FieldLabel", () => {
|
|
8
|
-
it("renders a real label element wired to a control via htmlFor", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(FieldLabel, { htmlFor: "host" }, "Host"),
|
|
11
|
-
);
|
|
12
|
-
assert.match(html, /<label/);
|
|
13
|
-
assert.match(html, /for="host"/);
|
|
14
|
-
assert.match(html, />Host</);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,43 +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 { MailActionToolbar } from "./mail-action-toolbar.js";
|
|
6
|
-
|
|
7
|
-
describe("MailActionToolbar", () => {
|
|
8
|
-
it("renders the triage cluster by default (desktop reading-pane behavior)", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(MailActionToolbar, { hasThread: true }),
|
|
11
|
-
);
|
|
12
|
-
assert.match(html, /aria-label="Reply"/);
|
|
13
|
-
assert.match(html, /aria-label="Move to Trash"/);
|
|
14
|
-
assert.match(html, /aria-label="Star"/);
|
|
15
|
-
assert.match(html, /aria-label="Move to mailbox"/);
|
|
16
|
-
// No archive verb — Remit is IMAP-backed (move-to-folder is the equivalent).
|
|
17
|
-
assert.doesNotMatch(html, /aria-label="Archive"/);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("hides the triage cluster when showTriage is false (mobile footer)", () => {
|
|
21
|
-
const html = renderToString(
|
|
22
|
-
createElement(MailActionToolbar, { hasThread: true, showTriage: false }),
|
|
23
|
-
);
|
|
24
|
-
// Reply verbs stay; triage is gone.
|
|
25
|
-
assert.match(html, /aria-label="Reply"/);
|
|
26
|
-
assert.match(html, /aria-label="Reply all"/);
|
|
27
|
-
assert.match(html, /aria-label="Forward"/);
|
|
28
|
-
assert.doesNotMatch(html, /aria-label="Archive"/);
|
|
29
|
-
assert.doesNotMatch(html, /aria-label="Move to Trash"/);
|
|
30
|
-
assert.doesNotMatch(html, /aria-label="Star"/);
|
|
31
|
-
assert.doesNotMatch(html, /aria-label="Move to mailbox"/);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("surfaces the unavailable hint when no thread is open", () => {
|
|
35
|
-
const html = renderToString(
|
|
36
|
-
createElement(MailActionToolbar, {
|
|
37
|
-
hasThread: false,
|
|
38
|
-
unavailableHint: "Open a message first",
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
assert.match(html, /Open a message first/);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,126 +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 { NavLinkSurface } from "./nav-link-surface.js";
|
|
6
|
-
|
|
7
|
-
describe("NavLinkSurface", () => {
|
|
8
|
-
it("renders a real anchor carrying the href", () => {
|
|
9
|
-
const html = renderToString(
|
|
10
|
-
createElement(NavLinkSurface, { href: "/mail/brief" }, "Daily brief"),
|
|
11
|
-
);
|
|
12
|
-
assert.match(html, /^<a /);
|
|
13
|
-
assert.match(html, /href="\/mail\/brief"/);
|
|
14
|
-
assert.match(html, /Daily brief/);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("renders no href attribute when given none", () => {
|
|
18
|
-
const html = renderToString(
|
|
19
|
-
createElement(NavLinkSurface, {}, "Daily brief"),
|
|
20
|
-
);
|
|
21
|
-
assert.doesNotMatch(html, /href=/);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("marks the current destination and styles it", () => {
|
|
25
|
-
const html = renderToString(
|
|
26
|
-
createElement(
|
|
27
|
-
NavLinkSurface,
|
|
28
|
-
{ href: "/mail/brief", current: "page" },
|
|
29
|
-
"Daily brief",
|
|
30
|
-
),
|
|
31
|
-
);
|
|
32
|
-
assert.match(html, /aria-current="page"/);
|
|
33
|
-
assert.match(html, /bg-accent-2-soft/);
|
|
34
|
-
assert.doesNotMatch(html, /text-fg-muted/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("styles a caller-supplied aria-current the same way", () => {
|
|
38
|
-
const html = renderToString(
|
|
39
|
-
createElement(
|
|
40
|
-
NavLinkSurface,
|
|
41
|
-
{ href: "/mail/brief", "aria-current": "page" },
|
|
42
|
-
"Daily brief",
|
|
43
|
-
),
|
|
44
|
-
);
|
|
45
|
-
assert.match(html, /aria-current="page"/);
|
|
46
|
-
assert.match(html, /bg-accent-2-soft/);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("treats aria-current=false as not current", () => {
|
|
50
|
-
const html = renderToString(
|
|
51
|
-
createElement(
|
|
52
|
-
NavLinkSurface,
|
|
53
|
-
{ href: "/mail/brief", "aria-current": "false" },
|
|
54
|
-
"Daily brief",
|
|
55
|
-
),
|
|
56
|
-
);
|
|
57
|
-
assert.match(html, /text-fg-muted/);
|
|
58
|
-
assert.doesNotMatch(html, /bg-accent-2-soft/);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("carries a focus ring on every variant", () => {
|
|
62
|
-
for (const variant of ["nav", "row", "inline"] as const) {
|
|
63
|
-
const html = renderToString(
|
|
64
|
-
createElement(NavLinkSurface, { href: "/x", variant }, "x"),
|
|
65
|
-
);
|
|
66
|
-
assert.match(html, /focus-visible:ring-2/, variant);
|
|
67
|
-
assert.match(html, /focus-visible:ring-ring/, variant);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("rings a full-bleed row inside its own edge", () => {
|
|
72
|
-
const html = renderToString(
|
|
73
|
-
createElement(NavLinkSurface, { href: "/x", variant: "row" }, "x"),
|
|
74
|
-
);
|
|
75
|
-
assert.match(html, /focus-visible:ring-inset/);
|
|
76
|
-
assert.doesNotMatch(html, /ring-offset/);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("rings a nav entry outside its own edge", () => {
|
|
80
|
-
const html = renderToString(
|
|
81
|
-
createElement(NavLinkSurface, { href: "/x", variant: "nav" }, "x"),
|
|
82
|
-
);
|
|
83
|
-
assert.match(html, /focus-visible:ring-offset-1/);
|
|
84
|
-
assert.doesNotMatch(html, /ring-inset/);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("underlines the inline variant on hover", () => {
|
|
88
|
-
const html = renderToString(
|
|
89
|
-
createElement(NavLinkSurface, { href: "/x", variant: "inline" }, "x"),
|
|
90
|
-
);
|
|
91
|
-
assert.match(html, /hover:underline/);
|
|
92
|
-
assert.match(html, /text-accent/);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("lets a caller's className override the variant's own colours", () => {
|
|
96
|
-
const html = renderToString(
|
|
97
|
-
createElement(
|
|
98
|
-
NavLinkSurface,
|
|
99
|
-
{ href: "/x", className: "text-danger" },
|
|
100
|
-
"x",
|
|
101
|
-
),
|
|
102
|
-
);
|
|
103
|
-
assert.match(html, /text-danger/);
|
|
104
|
-
assert.doesNotMatch(html, /text-fg-muted/);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("passes anchor attributes straight through", () => {
|
|
108
|
-
const html = renderToString(
|
|
109
|
-
createElement(
|
|
110
|
-
NavLinkSurface,
|
|
111
|
-
{
|
|
112
|
-
href: "https://example.com",
|
|
113
|
-
target: "_blank",
|
|
114
|
-
rel: "noopener noreferrer",
|
|
115
|
-
"data-testid": "nav-link",
|
|
116
|
-
title: "Example",
|
|
117
|
-
},
|
|
118
|
-
"x",
|
|
119
|
-
),
|
|
120
|
-
);
|
|
121
|
-
assert.match(html, /target="_blank"/);
|
|
122
|
-
assert.match(html, /rel="noopener noreferrer"/);
|
|
123
|
-
assert.match(html, /data-testid="nav-link"/);
|
|
124
|
-
assert.match(html, /title="Example"/);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,44 +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
|
-
NewFolderAction,
|
|
7
|
-
type NewFolderActionProps,
|
|
8
|
-
} from "./new-folder-action.js";
|
|
9
|
-
|
|
10
|
-
const render = (props: Partial<NewFolderActionProps>) =>
|
|
11
|
-
renderToString(
|
|
12
|
-
createElement(NewFolderAction, {
|
|
13
|
-
label: "New folder",
|
|
14
|
-
ariaLabel: "New folder",
|
|
15
|
-
onOpen: () => {},
|
|
16
|
-
...props,
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
describe("NewFolderAction", () => {
|
|
21
|
-
it("says what it makes, and where", () => {
|
|
22
|
-
const html = render({ ariaLabel: "New folder inside Travel" });
|
|
23
|
-
assert.match(html, /<button[^>]*aria-label="New folder inside Travel"/);
|
|
24
|
-
assert.match(html, />New folder</);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("takes the dashed add affordance where it is the pinned action", () => {
|
|
28
|
-
const html = render({});
|
|
29
|
-
assert.match(html, /data-prominence="prominent"/);
|
|
30
|
-
assert.match(html, /border-dashed/);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("stays neutral where it is the last thing inside a folder", () => {
|
|
34
|
-
const html = render({ prominence: "quiet", depth: 1 });
|
|
35
|
-
assert.match(html, /data-prominence="quiet"/);
|
|
36
|
-
assert.doesNotMatch(html, /border-dashed/);
|
|
37
|
-
assert.match(html, /width:14px/);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("insets the hairline to where the label starts", () => {
|
|
41
|
-
assert.match(render({ separated: true, depth: 1 }), /left:74px/);
|
|
42
|
-
assert.doesNotMatch(render({ depth: 1 }), /left:74px/);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,22 +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 { PaneHeader, type PaneHeaderProps } from "./pane-header.js";
|
|
6
|
-
|
|
7
|
-
const html = (props: PaneHeaderProps): string =>
|
|
8
|
-
renderToString(createElement(PaneHeader, props));
|
|
9
|
-
|
|
10
|
-
describe("PaneHeader", () => {
|
|
11
|
-
it("names the pane in its heading", () => {
|
|
12
|
-
assert.match(html({ title: "Outbox" }), /<h1[^>]*>Outbox<\/h1>/);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("draws no heading when the pane has no title", () => {
|
|
16
|
-
assert.doesNotMatch(html({}), /<h1/);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("sits on the pane-header datum", () => {
|
|
20
|
-
assert.match(html({ title: "Outbox" }), /h-pane-header/);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,46 +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 { PullToRefresh } from "./pull-to-refresh.js";
|
|
6
|
-
|
|
7
|
-
const noop = () => Promise.resolve();
|
|
8
|
-
const list = createElement("ul", null, "messages");
|
|
9
|
-
|
|
10
|
-
describe("PullToRefresh", () => {
|
|
11
|
-
it("renders its children inside the pull wrapper", () => {
|
|
12
|
-
const html = renderToString(
|
|
13
|
-
createElement(PullToRefresh, {
|
|
14
|
-
onRefresh: noop,
|
|
15
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
16
|
-
children: list,
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
assert.match(html, /messages/);
|
|
20
|
-
assert.match(html, /ptr/);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("keeps the gesture pullable while not refreshing", () => {
|
|
24
|
-
const html = renderToString(
|
|
25
|
-
createElement(PullToRefresh, {
|
|
26
|
-
onRefresh: noop,
|
|
27
|
-
isRefreshing: false,
|
|
28
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
29
|
-
children: list,
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
32
|
-
assert.match(html, /ptr/);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("still renders its children while a refresh is in flight", () => {
|
|
36
|
-
const html = renderToString(
|
|
37
|
-
createElement(PullToRefresh, {
|
|
38
|
-
onRefresh: noop,
|
|
39
|
-
isRefreshing: true,
|
|
40
|
-
// biome-ignore lint/correctness/noChildrenProp: React 19 types require children in props object when using createElement
|
|
41
|
-
children: list,
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
44
|
-
assert.match(html, /messages/);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,36 +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 { RecurrenceScopePrompt } from "./recurrence-scope-prompt.js";
|
|
6
|
-
|
|
7
|
-
const render = (touch = false) =>
|
|
8
|
-
renderToString(
|
|
9
|
-
createElement(RecurrenceScopePrompt, {
|
|
10
|
-
title: "Standup",
|
|
11
|
-
ruleText: "Every weekday, 09:15",
|
|
12
|
-
instanceText: "Wednesday 10 June",
|
|
13
|
-
onChoose: () => undefined,
|
|
14
|
-
onCancel: () => undefined,
|
|
15
|
-
touch,
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
describe("RecurrenceScopePrompt", () => {
|
|
20
|
-
it("offers all three scopes", () => {
|
|
21
|
-
const html = render();
|
|
22
|
-
assert.match(html, /This event/);
|
|
23
|
-
assert.match(html, /This and everything after/);
|
|
24
|
-
assert.match(html, /The whole series/);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("states the rule and the instance that was clicked", () => {
|
|
28
|
-
const html = render();
|
|
29
|
-
assert.match(html, /Every weekday, 09:15/);
|
|
30
|
-
assert.match(html, /Wednesday 10 June/);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("grows the choices for a thumb", () => {
|
|
34
|
-
assert.match(render(true), /min-h-11/);
|
|
35
|
-
});
|
|
36
|
-
});
|