({ PluginSlot: () => null }));
vi.mock('@/components/tour/tour-provider', () => ({
@@ -42,9 +44,36 @@ function narrowWindow(narrow: boolean) {
})) as typeof window.matchMedia;
}
-describe('folder sidebar header', () => {
+describe('folder sidebar header, by default', () => {
beforeEach(() => {
- useSettingsStore.setState({ interfaceLayout: 'default', enableUnifiedMailbox: false } as never);
+ useSettingsStore.setState({
+ interfaceLayout: 'default',
+ enableUnifiedMailbox: false,
+ sidebarAccountSwitcher: useSettingsStore.getInitialState().sidebarAccountSwitcher,
+ } as never);
+ useUIStore.setState({ sidebarCollapsed: false } as never);
+ narrowWindow(false);
+ });
+ afterEach(() => {
+ window.matchMedia = realMatchMedia;
+ });
+
+ it('starts with the account switcher and leaves Compose to the round button', () => {
+ render(
stub composer
; }, })); -// On a desktop Compose sits at the head of the folder sidebar (mail-13). -vi.mock('@/components/layout/sidebar', () => ({ - Sidebar: ({ onCompose }: { onCompose?: () => void }) => (device.isMobile ? null : ), -})); +// With sidebarAccountSwitcher off, Compose sits at the head of the folder +// sidebar on a desktop (mail-13); by default it is the round button. +vi.mock('@/components/layout/sidebar', async () => { + const { useSettingsStore: settings } = await import('@/stores/settings-store'); + return { + Sidebar: ({ onCompose }: { onCompose?: () => void }) => { + const switcherOnTop = settings((s) => s.sidebarAccountSwitcher); + return device.isMobile || switcherOnTop ? null : ; + }, + }; +}); vi.mock('@/components/layout/navigation-rail', () => ({ NavigationRail: () => null })); vi.mock('@/components/layout/calendar-event-notification-toaster', () => ({ CalendarEventNotificationToaster: () => null })); vi.mock('@/components/layout/share-notification-toaster', () => ({ ShareNotificationToaster: () => null })); @@ -95,7 +102,7 @@ beforeEach(() => { getClientForAccount: () => client as never, getAllConnectedClients: () => new Map([['login', client]]) as never, }); - useSettingsStore.setState({ enableUnifiedMailbox: false, mailLayout: 'split', sendDelaySeconds: 0 } as never); + useSettingsStore.setState({ enableUnifiedMailbox: false, mailLayout: 'split', sendDelaySeconds: 0, sidebarAccountSwitcher: true } as never); sendEmail.mockReset().mockResolvedValue({}); useUIStore.setState({ activeView: 'list', sidebarOpen: false }); useEmailStore.setState({ @@ -128,14 +135,19 @@ describe('Mail after the tour on a phone', () => { }); // Usability test 2026-11-04, mail-13: on a desktop the round button sat on - // the list's rows; Compose is at the head of the folder sidebar there. - it('draws the round Compose button on a phone, not on a desktop', () => { + // the list's rows. It stays by default, with the account switcher at the + // head of the folder sidebar; turned off, Compose is there instead. + it('draws the round Compose button on a phone, and on a desktop unless Compose is in the sidebar', () => { const view = render(