fix: repair title bar toggle checks

This commit is contained in:
Erwan Leboucher committed 2026-07-23 08:36:22 +02:00
1 parent 84832d7420
commit af6fa7888c
4 files changed
+17 -6

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
default: patch
---
Allow using native window chrome instead of the custom title bar.
@@ -13,7 +13,7 @@ const {
mockUseDesktopSettingsSyncing,
mockSetUseCustomTitleBar,
} = vi.hoisted(() => {
const mockSetUseCustomTitleBar = vi.fn<(value: boolean) => void>();
const setUseCustomTitleBarMock = vi.fn<(value: boolean) => void>();
return {
mockUseDesktopSetting: vi.fn<
@@ -21,11 +21,11 @@ const {
key: 'closeToBackgroundOnClose' | 'showSystemTrayIcon' | 'useCustomTitleBar'
) => readonly [boolean, (value: boolean) => void]
>((key) => {
if (key === 'useCustomTitleBar') return [true, mockSetUseCustomTitleBar] as const;
if (key === 'useCustomTitleBar') return [true, setUseCustomTitleBarMock] as const;
if (key === 'closeToBackgroundOnClose') return [true, vi.fn<() => void>()] as const;
return [true, vi.fn<() => void>()] as const;
}),
mockSetUseCustomTitleBar,
mockSetUseCustomTitleBar: setUseCustomTitleBarMock,
mockUseDesktopSettingsReady: vi.fn<() => boolean>(() => true),
mockUseDesktopSettingsSyncing: vi.fn<() => boolean>(() => false),
mockUseDesktopRuntimeState: vi.fn<() => { trayAvailable: boolean }>(() => ({
+1 -1
View File
@@ -19,7 +19,7 @@ vi.mock('$hooks/useSyncState', () => ({
}));
vi.mock('$state/hooks/desktopSettings', () => ({
useDesktopSetting: () => [false, vi.fn()] as const,
useDesktopSetting: () => [false, vi.fn<() => void>()] as const,
}));
import { SyncState } from '$types/matrix-sdk';
+8 -2
View File
@@ -40,7 +40,11 @@ describe('android edge-to-edge inset contract', () => {
expect(appTsx).toContain('screenSize={screenSize}');
expect(appTsx).toContain('queryClient={queryClient}');
expect(appShell).toContain('const [portalContainer, setPortalContainer] = useState');
expect(appShell).toContain('<SystemBarShell onPortalContainerChange={setPortalContainer}>');
expect(appShell).toContain('onPortalContainerChange={setPortalContainer}');
expect(appShell).toContain('function AppShellFrame');
expect(appShell).toContain(
'<SystemBarShell onPortalContainerChange={onPortalContainerChange}>'
);
expect(systemBarShell).toContain('ref={onPortalContainerChange}');
});
@@ -49,7 +53,9 @@ describe('android edge-to-edge inset contract', () => {
const systemBarShell = readWorkspaceFile('src/app/components/app-shell/SystemBarShell.tsx');
const mobileCapability = readWorkspaceFile('src-tauri/capabilities/mobile.json');
expect(appShell).toContain('const contentHeight = hasCustomTitleBar');
expect(appShell).toContain(
"const contentHeight = titlebarKind ? 'calc(100% - var(--tauri-titlebar-height))' : '100%';"
);
expect(appShell).toContain("height: '100%'");
expect(appShell).toContain('height: contentHeight');
expect(appShell).toContain('<ScreenSizeProvider value={screenSize}>');