@remit/ui 0.0.191 → 0.0.193

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.
@@ -0,0 +1,82 @@
1
+ /**
2
+ * How a switched-off service reads wherever its account or its stored rows are
3
+ * (#1179). Every surface says the same thing, and the notice over stored rows
4
+ * says what stayed before it says what stopped.
5
+ */
6
+ import "@remit/test-dom";
7
+ import assert from "node:assert/strict";
8
+ import { describe, it } from "node:test";
9
+ import { createElement } from "react";
10
+ import { renderToString } from "react-dom/server";
11
+ import {
12
+ AccountServiceOffBadge,
13
+ AccountServiceOffNotice,
14
+ } from "./account-service-status.js";
15
+
16
+ describe("AccountServiceOffBadge", () => {
17
+ it("labels a mail-disabled account", () => {
18
+ assert.match(
19
+ renderToString(
20
+ createElement(AccountServiceOffBadge, { service: "Mail" }),
21
+ ),
22
+ /mail sync off/,
23
+ );
24
+ });
25
+
26
+ it("labels a calendar-disabled account", () => {
27
+ assert.match(
28
+ renderToString(
29
+ createElement(AccountServiceOffBadge, { service: "Calendar" }),
30
+ ),
31
+ /calendar sync off/,
32
+ );
33
+ });
34
+ });
35
+
36
+ describe("AccountServiceOffNotice", () => {
37
+ it("says the stored mail is there before it says sync stopped", () => {
38
+ const html = renderToString(
39
+ createElement(AccountServiceOffNotice, { service: "Mail" }),
40
+ );
41
+ assert.match(html, /Everything already synced is here to read/);
42
+ assert.ok(
43
+ html.indexOf("here to read") < html.indexOf("nothing new arrives"),
44
+ );
45
+ });
46
+
47
+ it("keeps a paused calendar's events on the calendar", () => {
48
+ assert.match(
49
+ renderToString(
50
+ createElement(AccountServiceOffNotice, { service: "Calendar" }),
51
+ ),
52
+ /Its events stay on your calendar/,
53
+ );
54
+ });
55
+
56
+ it("states the account rather than raising an alarm", () => {
57
+ assert.match(
58
+ renderToString(
59
+ createElement(AccountServiceOffNotice, { service: "Mail" }),
60
+ ),
61
+ /role="status"/,
62
+ );
63
+ });
64
+
65
+ it("offers the way back on only when it is given one", () => {
66
+ assert.doesNotMatch(
67
+ renderToString(
68
+ createElement(AccountServiceOffNotice, { service: "Mail" }),
69
+ ),
70
+ /Turn mail back on/,
71
+ );
72
+ assert.match(
73
+ renderToString(
74
+ createElement(AccountServiceOffNotice, {
75
+ service: "Mail",
76
+ onEnable: () => {},
77
+ }),
78
+ ),
79
+ /Turn mail back on/,
80
+ );
81
+ });
82
+ });
@@ -0,0 +1,61 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import {
4
+ AccountServiceOffBadge,
5
+ AccountServiceOffNotice,
6
+ } from "./account-service-status.js";
7
+
8
+ /**
9
+ * How a switched-off service reads on the surfaces that hold what it left
10
+ * behind (#1179): a label wherever the account is listed, and a notice over the
11
+ * stored rows themselves.
12
+ */
13
+ const meta: Meta = {
14
+ title: "Components/AccountServiceStatus",
15
+ parameters: { layout: "padded" },
16
+ };
17
+ export default meta;
18
+
19
+ type Story = StoryObj;
20
+
21
+ /** The label an account carries in a list, a picker or the sidebar. */
22
+ export const Badges: Story = {
23
+ render: () => (
24
+ <div className="flex flex-col items-start gap-2">
25
+ <AccountServiceOffBadge service="Mail" />
26
+ <AccountServiceOffBadge service="Calendar" />
27
+ </div>
28
+ ),
29
+ };
30
+
31
+ /**
32
+ * Over a mail-disabled account's stored mailboxes. It says what is there before
33
+ * it says what stopped — an empty-looking mailbox is the failure this exists to
34
+ * prevent.
35
+ */
36
+ export const MailNotice: Story = {
37
+ render: () => (
38
+ <AccountServiceOffNotice service="Mail" onEnable={() => undefined} />
39
+ ),
40
+ play: async ({ canvasElement }) => {
41
+ const canvas = within(canvasElement);
42
+ await expect(
43
+ canvas.getByText(/Everything already synced is here to read/),
44
+ ).toBeVisible();
45
+ await expect(
46
+ canvas.getByRole("button", { name: "Turn mail back on" }),
47
+ ).toBeVisible();
48
+ },
49
+ };
50
+
51
+ /** Over a paused provider calendar. Its events stay drawn on the grid. */
52
+ export const CalendarNotice: Story = {
53
+ render: () => (
54
+ <AccountServiceOffNotice service="Calendar" onEnable={() => undefined} />
55
+ ),
56
+ };
57
+
58
+ /** No way back on from here — the notice is a statement, never a dead button. */
59
+ export const NoticeWithoutAction: Story = {
60
+ render: () => <AccountServiceOffNotice service="Mail" />,
61
+ };
@@ -0,0 +1,89 @@
1
+ import { PauseCircle } from "lucide-react";
2
+ import { cn } from "../lib/cn.js";
3
+ import type { AccountService } from "./account-service-choice.js";
4
+ import { Badge } from "./badge.js";
5
+ import { Banner } from "./banner.js";
6
+
7
+ /**
8
+ * How every surface names a service an account has switched off. One wording,
9
+ * so an account list, a picker and the sidebar say the same thing about the
10
+ * same account.
11
+ */
12
+ export const ACCOUNT_SERVICE_OFF_LABEL: Record<AccountService, string> = {
13
+ Mail: "mail sync off",
14
+ Calendar: "calendar sync off",
15
+ };
16
+
17
+ /**
18
+ * What the stored rows are, said where they are read. Disabling deletes
19
+ * nothing, so the surface holding the rows says what it is holding rather than
20
+ * reading as a broken account or an empty mailbox.
21
+ */
22
+ export const ACCOUNT_SERVICE_OFF_MESSAGE: Record<AccountService, string> = {
23
+ Mail: "Mail sync is off for this account. Everything already synced is here to read; nothing new arrives until you turn mail back on.",
24
+ Calendar:
25
+ "Calendar sync is off for this account. Its events stay on your calendar; nothing new arrives until you turn calendar back on.",
26
+ };
27
+
28
+ /**
29
+ * Why an account is offered no switches at all. An IMAP connector carries mail
30
+ * alone, so the screen says that rather than showing a control that can never
31
+ * move.
32
+ */
33
+ export const ACCOUNT_NO_SERVICE_TOGGLES_MESSAGE =
34
+ "This account connects over IMAP, which carries mail and nothing else. There is nothing to switch.";
35
+
36
+ export interface AccountServiceOffBadgeProps {
37
+ service: AccountService;
38
+ className?: string;
39
+ }
40
+
41
+ /**
42
+ * The label an account carries wherever it is listed while a service is off. It
43
+ * is a label and never a removal: the account keeps its place in the list, the
44
+ * picker and the sidebar (#1179).
45
+ */
46
+ export function AccountServiceOffBadge({
47
+ service,
48
+ className,
49
+ }: AccountServiceOffBadgeProps) {
50
+ return (
51
+ <Badge tone="neutral" className={className}>
52
+ <PauseCircle className="size-3 shrink-0" aria-hidden />
53
+ {ACCOUNT_SERVICE_OFF_LABEL[service]}
54
+ </Badge>
55
+ );
56
+ }
57
+
58
+ export interface AccountServiceOffNoticeProps {
59
+ service: AccountService;
60
+ /** The way back on. Absent leaves the notice a statement. */
61
+ onEnable?: () => void;
62
+ className?: string;
63
+ }
64
+
65
+ /**
66
+ * The notice above stored rows a switched-off service left behind — a mailbox
67
+ * opened directly, or a provider calendar still drawn on the grid. It states
68
+ * what stayed and what stopped, and offers the switch that resumes it.
69
+ */
70
+ export function AccountServiceOffNotice({
71
+ service,
72
+ onEnable,
73
+ className,
74
+ }: AccountServiceOffNoticeProps) {
75
+ return (
76
+ <Banner tone="info" variant="soft" className={cn("text-xs", className)}>
77
+ <span>{ACCOUNT_SERVICE_OFF_MESSAGE[service]}</span>
78
+ {onEnable && (
79
+ <button
80
+ type="button"
81
+ onClick={onEnable}
82
+ className="ml-1 font-medium text-accent underline"
83
+ >
84
+ {service === "Mail" ? "Turn mail back on" : "Turn calendar back on"}
85
+ </button>
86
+ )}
87
+ </Banner>
88
+ );
89
+ }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * The service switches on account settings (#1179). What is pinned here is the
3
+ * contract the ADR binds: an IMAP account gets no switches at all, a service the
4
+ * grant never covered names the sign-in round trip before it is pressed, and a
5
+ * press asks the host rather than flipping anything itself.
6
+ */
7
+ import "@remit/test-dom";
8
+ import assert from "node:assert/strict";
9
+ import { describe, it } from "node:test";
10
+ import { act, createElement } from "react";
11
+ import { createRoot } from "react-dom/client";
12
+ import { renderToString } from "react-dom/server";
13
+ import type { AccountService } from "./account-service-choice.js";
14
+ import {
15
+ type AccountServiceIntent,
16
+ AccountServiceToggles,
17
+ type AccountServiceTogglesProps,
18
+ } from "./account-service-toggles.js";
19
+
20
+ const bothServices: AccountService[] = ["Mail", "Calendar"];
21
+
22
+ const props = (
23
+ overrides: Partial<AccountServiceTogglesProps> = {},
24
+ ): AccountServiceTogglesProps => ({
25
+ providerName: "Microsoft",
26
+ offered: bothServices,
27
+ enabled: bothServices,
28
+ consented: bothServices,
29
+ onRequestChange: () => {},
30
+ ...overrides,
31
+ });
32
+
33
+ const render = (overrides: Partial<AccountServiceTogglesProps> = {}): string =>
34
+ renderToString(createElement(AccountServiceToggles, props(overrides)));
35
+
36
+ interface Press {
37
+ service: AccountService;
38
+ intent: AccountServiceIntent;
39
+ }
40
+
41
+ function pressSwitch(
42
+ index: number,
43
+ overrides: Partial<AccountServiceTogglesProps> = {},
44
+ ): Press[] {
45
+ const container = document.createElement("div");
46
+ document.body.appendChild(container);
47
+ const root = createRoot(container);
48
+ const presses: Press[] = [];
49
+
50
+ act(() => {
51
+ root.render(
52
+ createElement(
53
+ AccountServiceToggles,
54
+ props({
55
+ ...overrides,
56
+ onRequestChange: (service, intent) =>
57
+ presses.push({ service, intent }),
58
+ }),
59
+ ),
60
+ );
61
+ });
62
+
63
+ const switches =
64
+ container.querySelectorAll<HTMLButtonElement>('[role="switch"]');
65
+ act(() => {
66
+ switches[index]?.click();
67
+ });
68
+
69
+ act(() => {
70
+ root.unmount();
71
+ });
72
+ container.remove();
73
+ return presses;
74
+ }
75
+
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
+ it("shows each switch in the state the account is in", () => {
84
+ const html = render({ enabled: ["Calendar"] });
85
+ assert.equal(html.match(/aria-checked="true"/g)?.length, 1);
86
+ assert.equal(html.match(/aria-checked="false"/g)?.length, 1);
87
+ });
88
+
89
+ it("renders nothing for an IMAP account, which syncs mail alone", () => {
90
+ assert.equal(render({ offered: ["Mail"], enabled: ["Mail"] }), "");
91
+ });
92
+
93
+ it("names the sign-in round trip on a service the grant never covered", () => {
94
+ assert.match(
95
+ render({ enabled: ["Mail"], consented: ["Mail"] }),
96
+ /Turning this on means signing in with Microsoft again\./,
97
+ );
98
+ });
99
+
100
+ it("says nothing about signing in for a service the grant covers", () => {
101
+ assert.doesNotMatch(
102
+ render({ enabled: ["Mail"] }),
103
+ /signing in with Microsoft again/,
104
+ );
105
+ });
106
+
107
+ it("says nothing about signing in for a service already on", () => {
108
+ assert.doesNotMatch(
109
+ render({ consented: ["Mail"] }),
110
+ /signing in with Microsoft again/,
111
+ );
112
+ });
113
+
114
+ it("asks the host to switch a running service off", () => {
115
+ assert.deepEqual(pressSwitch(0), [{ service: "Mail", intent: "off" }]);
116
+ });
117
+
118
+ it("asks the host to switch a stopped service on", () => {
119
+ assert.deepEqual(pressSwitch(1, { enabled: ["Mail"] }), [
120
+ { service: "Calendar", intent: "on" },
121
+ ]);
122
+ });
123
+ });
@@ -0,0 +1,121 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, userEvent, within } from "storybook/test";
3
+ import type { AccountService } from "./account-service-choice.js";
4
+ import { ACCOUNT_NO_SERVICE_TOGGLES_MESSAGE } from "./account-service-status.js";
5
+ import {
6
+ type AccountServiceIntent,
7
+ AccountServiceToggles,
8
+ } from "./account-service-toggles.js";
9
+
10
+ /**
11
+ * What an account syncs, on its settings screen (#1179). The switch asks; the
12
+ * host confirms and commits.
13
+ */
14
+ const meta: Meta<typeof AccountServiceToggles> = {
15
+ title: "Components/AccountServiceToggles",
16
+ component: AccountServiceToggles,
17
+ parameters: { layout: "padded" },
18
+ decorators: [
19
+ (Story) => (
20
+ <div className="mx-auto max-w-sm rounded-xl border border-line bg-surface p-4">
21
+ <Story />
22
+ </div>
23
+ ),
24
+ ],
25
+ };
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof AccountServiceToggles>;
29
+
30
+ const bothServices: AccountService[] = ["Mail", "Calendar"];
31
+
32
+ /**
33
+ * Stands in for the host that owns the change: the switch reports the ask and
34
+ * nothing moves until the host answers it, which is what these stories show.
35
+ */
36
+ function Toggles({
37
+ enabled,
38
+ consented = bothServices,
39
+ offered = bothServices,
40
+ onRequestChange = () => {},
41
+ }: {
42
+ enabled: AccountService[];
43
+ consented?: AccountService[];
44
+ offered?: AccountService[];
45
+ onRequestChange?: (
46
+ service: AccountService,
47
+ intent: AccountServiceIntent,
48
+ ) => void;
49
+ }) {
50
+ return (
51
+ <AccountServiceToggles
52
+ providerName="Microsoft"
53
+ offered={offered}
54
+ enabled={enabled}
55
+ consented={consented}
56
+ onRequestChange={onRequestChange}
57
+ />
58
+ );
59
+ }
60
+
61
+ /** Both services on: the state an Outlook account arrives in from onboarding. */
62
+ export const BothOn: Story = {
63
+ render: () => <Toggles enabled={bothServices} />,
64
+ };
65
+
66
+ /**
67
+ * Mail off. The switch is the only thing that changed — the account keeps its
68
+ * place and its stored mail, which the other surfaces say for themselves.
69
+ */
70
+ export const MailOff: Story = {
71
+ render: () => <Toggles enabled={["Calendar"]} />,
72
+ };
73
+
74
+ /**
75
+ * Calendar was never consented to. The row says what turning it on costs before
76
+ * it is pressed, because no saved setting can grant a scope.
77
+ */
78
+ export const CalendarNeedsConsent: Story = {
79
+ render: () => <Toggles enabled={["Mail"]} consented={["Mail"]} />,
80
+ play: async ({ canvasElement }) => {
81
+ const canvas = within(canvasElement);
82
+ await expect(
83
+ canvas.getByText(/signing in with Microsoft again/),
84
+ ).toBeVisible();
85
+ },
86
+ };
87
+
88
+ /**
89
+ * Pressing a running service asks to switch it off. Nothing moves on screen:
90
+ * the host raises the confirmation and owns the change.
91
+ */
92
+ export const AsksBeforeItMoves: Story = {
93
+ render: () => <Toggles enabled={bothServices} />,
94
+ play: async ({ canvasElement }) => {
95
+ const canvas = within(canvasElement);
96
+ const mail = canvas.getByRole("switch", { name: "Sync mail" });
97
+ await userEvent.click(mail);
98
+ await expect(mail).toBeChecked();
99
+ },
100
+ };
101
+
102
+ /**
103
+ * An IMAP account. It syncs mail and nothing else, so there is nothing to
104
+ * switch — the border below is the whole render.
105
+ */
106
+ export const ImapAccount: Story = {
107
+ render: () => (
108
+ <>
109
+ <AccountServiceToggles
110
+ providerName="Fastmail"
111
+ offered={["Mail"]}
112
+ enabled={["Mail"]}
113
+ consented={["Mail"]}
114
+ onRequestChange={() => {}}
115
+ />
116
+ <p className="border-t border-line pt-2 text-2xs text-fg-subtle">
117
+ {ACCOUNT_NO_SERVICE_TOGGLES_MESSAGE}
118
+ </p>
119
+ </>
120
+ ),
121
+ };
@@ -0,0 +1,125 @@
1
+ import { useId } from "react";
2
+ import { cn } from "../lib/cn.js";
3
+ import {
4
+ ACCOUNT_SERVICE_ROWS,
5
+ type AccountService,
6
+ } from "./account-service-choice.js";
7
+
8
+ /**
9
+ * A service switch on the account settings screen. Switching off always asks,
10
+ * because it stops a sync. Switching on asks only when the grant does not cover
11
+ * the service yet, because granting it leaves for the provider; a service the
12
+ * consent already covers comes back on without a question.
13
+ */
14
+ export type AccountServiceIntent = "on" | "off";
15
+
16
+ export interface AccountServiceTogglesProps {
17
+ /** Provider named in the consent note, e.g. "Microsoft". */
18
+ providerName: string;
19
+ /** Services this account's connector carries. Under two, nothing renders. */
20
+ offered: AccountService[];
21
+ /** Services the account syncs today. */
22
+ enabled: AccountService[];
23
+ /** Services the account's grant already covers. The rest cost a sign-in. */
24
+ consented: AccountService[];
25
+ /** Asks the host for a change. The host owns the question and the commit. */
26
+ onRequestChange: (
27
+ service: AccountService,
28
+ intent: AccountServiceIntent,
29
+ ) => void;
30
+ }
31
+
32
+ function ServiceSwitch({
33
+ checked,
34
+ label,
35
+ describedBy,
36
+ onToggle,
37
+ }: {
38
+ checked: boolean;
39
+ label: string;
40
+ describedBy: string;
41
+ onToggle: () => void;
42
+ }) {
43
+ return (
44
+ <button
45
+ type="button"
46
+ role="switch"
47
+ aria-checked={checked}
48
+ aria-label={label}
49
+ aria-describedby={describedBy}
50
+ onClick={onToggle}
51
+ className={cn(
52
+ "relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors",
53
+ "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",
54
+ checked
55
+ ? "border-positive bg-positive"
56
+ : "border-line-strong bg-surface-sunken",
57
+ )}
58
+ >
59
+ <span
60
+ aria-hidden
61
+ className={cn(
62
+ "size-4 rounded-full bg-canvas transition-transform",
63
+ checked ? "translate-x-6" : "translate-x-1",
64
+ )}
65
+ />
66
+ </button>
67
+ );
68
+ }
69
+
70
+ /**
71
+ * What an account syncs, on the account settings screen (#1179). One switch per
72
+ * service the connector carries, mail first.
73
+ *
74
+ * An IMAP account carries mail and nothing else, so it gets no switches at all
75
+ * rather than one it can never move — the same rule the onboarding choice
76
+ * follows for a single-service provider.
77
+ */
78
+ export function AccountServiceToggles({
79
+ providerName,
80
+ offered,
81
+ enabled,
82
+ consented,
83
+ onRequestChange,
84
+ }: AccountServiceTogglesProps) {
85
+ const groupId = useId();
86
+ const rows = ACCOUNT_SERVICE_ROWS.filter((row) => offered.includes(row.id));
87
+
88
+ if (rows.length < 2) return null;
89
+
90
+ return (
91
+ <fieldset>
92
+ <legend className="text-sm font-semibold text-fg">
93
+ What this account syncs
94
+ </legend>
95
+ <div className="mt-1 divide-y divide-line">
96
+ {rows.map((row) => {
97
+ const on = enabled.includes(row.id);
98
+ const noteId = `${groupId}-${row.id}`;
99
+ const needsConsent = !on && !consented.includes(row.id);
100
+ return (
101
+ <div
102
+ key={row.id}
103
+ className="flex min-h-11 items-center gap-3 py-2 text-left"
104
+ >
105
+ <span className="flex min-w-0 flex-1 flex-col">
106
+ <span className="text-sm text-fg">{row.label}</span>
107
+ <span id={noteId} className="text-xs text-fg-subtle">
108
+ {needsConsent
109
+ ? `${row.description} Turning this on means signing in with ${providerName} again.`
110
+ : row.description}
111
+ </span>
112
+ </span>
113
+ <ServiceSwitch
114
+ checked={on}
115
+ label={`Sync ${row.label.toLowerCase()}`}
116
+ describedBy={noteId}
117
+ onToggle={() => onRequestChange(row.id, on ? "off" : "on")}
118
+ />
119
+ </div>
120
+ );
121
+ })}
122
+ </div>
123
+ </fieldset>
124
+ );
125
+ }
@@ -12,6 +12,7 @@ import type {
12
12
  } from "../category-presentation.js";
13
13
  import type { TriageHandlers } from "../lib/keymap.js";
14
14
  import type { SelectionModifiers } from "../lib/use-selection.js";
15
+ import type { AccountService } from "./account-service-choice.js";
15
16
  import type {
16
17
  IntelligenceData,
17
18
  SenderTrustLevel,
@@ -198,6 +199,12 @@ export interface NavAccount {
198
199
  email: string;
199
200
  /** Muted: excluded from unified views, still syncing. Rendered dimmed. */
200
201
  muted?: boolean;
202
+ /**
203
+ * Services this account syncs. Absent is the account that syncs mail, which
204
+ * is every IMAP account. An account without `Mail` keeps its place in the
205
+ * nav with every mailbox it already synced, labelled rather than dropped.
206
+ */
207
+ syncedServices?: AccountService[];
201
208
  mailboxes: NavMailbox[];
202
209
  /**
203
210
  * Number of outbox messages pending send. When provided, an Outbox entry
@@ -75,3 +75,37 @@ describe("CalendarList", () => {
75
75
  assert.match(html, /Family/);
76
76
  });
77
77
  });
78
+
79
+ /**
80
+ * A provider calendar whose account has calendar sync off. Nothing was deleted,
81
+ * so the row stays, its tick keeps drawing the stored events, and the pause is
82
+ * a label on the row (#1179).
83
+ */
84
+ describe("CalendarList with a paused calendar", () => {
85
+ const paused: CalendarDescriptor[] = calendars.map((calendar) =>
86
+ calendar.id === "c1" ? { ...calendar, sync: "paused" } : calendar,
87
+ );
88
+
89
+ const renderPaused = (visible: string[]) =>
90
+ renderToString(
91
+ createElement(CalendarList, {
92
+ calendars: paused,
93
+ visible: new Set(visible),
94
+ onToggle: () => undefined,
95
+ }),
96
+ );
97
+
98
+ it("keeps the row and labels the pause", () => {
99
+ const html = renderPaused(["c1"]);
100
+ assert.match(html, /Northwind/);
101
+ assert.match(html, /calendar sync off/);
102
+ });
103
+
104
+ it("leaves a live calendar unlabelled", () => {
105
+ assert.doesNotMatch(render(["c1"]), /calendar sync off/);
106
+ });
107
+
108
+ it("keeps a paused calendar tickable, so its events stay drawable", () => {
109
+ assert.match(renderPaused(["c1"]), /checked=""/);
110
+ });
111
+ });
@@ -169,6 +169,38 @@ export const SingleCalendar: Story = {
169
169
  },
170
170
  };
171
171
 
172
+ /**
173
+ * A paused provider calendar. Sync stopped; the calendar is still listed, still
174
+ * coloured and still tickable, so the pause icon is decoration and the words
175
+ * that carry it sit beside the row rather than inside the tick's name.
176
+ */
177
+ export const Paused: Story = {
178
+ render: () => {
179
+ const paused = calendars.map((calendar) =>
180
+ calendar.id === "c1"
181
+ ? { ...calendar, sync: "paused" as const }
182
+ : calendar,
183
+ );
184
+ return (
185
+ <CalendarList
186
+ calendars={paused}
187
+ visible={new Set(calendars.map((c) => c.id))}
188
+ onToggle={() => {}}
189
+ onToggleAccount={() => {}}
190
+ />
191
+ );
192
+ },
193
+ play: async ({ canvasElement }) => {
194
+ const canvas = within(canvasElement);
195
+ await expect(
196
+ canvas.getByRole("checkbox", { name: "Northwind" }),
197
+ ).toBeChecked();
198
+ await expect(
199
+ canvas.getByText("Northwind: calendar sync off"),
200
+ ).toBeInTheDocument();
201
+ },
202
+ };
203
+
172
204
  /**
173
205
  * The same control on a surface with no room for a rail: a scrolling row of
174
206
  * chips at thumb size. It is laid out differently and it is not a popover —