mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 00:14:18 +00:00
fix: show the desktop app's offline warning once
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'fake-indexeddb/auto';
|
||||
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
||||
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const offline = vi.hoisted(() => ({
|
||||
@@ -311,10 +311,11 @@ describe('in the desktop app', () => {
|
||||
|
||||
it('says what the risk is there, and only there', () => {
|
||||
render(<OfflineSettings />);
|
||||
expect(screen.queryByTestId('offline-desktop-warning')).toBeNull();
|
||||
expect(screen.getByTestId('offline-warning').textContent).toBe('warning');
|
||||
cleanup();
|
||||
(window as { bulwarkDesktop?: unknown }).bulwarkDesktop = { version: 1 };
|
||||
render(<OfflineSettings />);
|
||||
expect(screen.getByTestId('offline-desktop-warning').textContent).toBe('warning_desktop');
|
||||
expect(screen.getAllByTestId('offline-warning').map((node) => node.textContent)).toEqual(['warning_desktop']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { SettingItem, Select, ToggleSwitch } from '@/components/settings/setting
|
||||
import { OrgLockedNote } from '@/components/settings/org-locked-note';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||
import { isDesktopApp } from '@/lib/desktop/bridge';
|
||||
import { formatFileSize } from '@/lib/utils';
|
||||
import { chooseScope, clearAccount, disableOffline, dismissStoreReset, enableOffline, scopeForAccount, unsentCount } from '@/lib/offline/offline-mode';
|
||||
import { attachmentCapOptions, maxAttachmentMb, windowOptions } from '@/lib/offline/scope';
|
||||
@@ -144,7 +143,6 @@ export function AccountStorage({ account, primary, heading }: { account: string;
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
{isDesktopApp() && <p className="text-xs text-muted-foreground" data-testid={testId('offline-desktop-warning')}>{tStorage('warning_desktop')}</p>}
|
||||
{storeReset && (
|
||||
<div className="my-2 flex flex-col gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-900 dark:text-amber-200 sm:flex-row sm:items-center sm:justify-between" role="alert" data-testid="offline-evicted">
|
||||
<p className="min-w-0">
|
||||
|
||||
Reference in New Issue
Block a user