feat(web): Einstellungen → Desktop-App zeigt in der App den verbundenen Server

- DesktopAppSettings rendert im Desktop-Client (useIsDesktopClient) einen Block "Verbunden mit: {origin}" plus Hinweis auf "Server-Adresse ändern…" im Infobereich-Menü; im Browser bleibt der Block weg
- Neue i18n-Schlüssel settings.desktop.connectedTo/changeHint in de.json und en.json
- Test 4 (Cookie tessera_desktop=1) und Test 5 (ohne Cookie) ergänzt; RED zuerst (Test 4 schlug auf der Zielbehauptung fehl), dann GREEN
- Alle 431 Web-Tests und type-check grün

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 14:52:47 +02:00
parent 29c132ecf3
commit 4c79874278
4 changed files with 51 additions and 4 deletions
@@ -1,5 +1,6 @@
import { cleanup, render, screen } from '@testing-library/react';
import { act, cleanup, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { DESKTOP_COOKIE_NAME } from '@/lib/desktop-client';
import { DesktopAppSettings } from './desktop-app-settings';
/**
@@ -34,9 +35,14 @@ vi.mock('@/lib/desktop', async (importOriginal) => {
};
});
function clearDesktopCookie() {
document.cookie = `${DESKTOP_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
}
afterEach(() => {
cleanup();
vi.clearAllMocks();
clearDesktopCookie();
});
const windowsFile = {
@@ -102,4 +108,24 @@ describe('DesktopAppSettings (18-03)', () => {
),
).toBeInTheDocument();
});
it('Test 4 (im Desktop-Client): zeigt verbundenen Server und Änderungshinweis', async () => {
document.cookie = `${DESKTOP_COOKIE_NAME}=1; path=/`;
loadDesktopLatest.mockResolvedValue(null);
render(<DesktopAppSettings />);
expect(await screen.findByText('Verbunden mit: http://localhost:3000')).toBeInTheDocument();
expect(
screen.getByText('Ändern über das Tessera-Symbol im Infobereich → „Server-Adresse ändern…“'),
).toBeInTheDocument();
expect(screen.getByTestId('desktop-connected')).toBeInTheDocument();
});
it('Test 5 (im Browser): kein Block ohne Desktop-Cookie', async () => {
loadDesktopLatest.mockResolvedValue(null);
render(<DesktopAppSettings />);
await act(async () => {});
expect(screen.queryByTestId('desktop-connected')).toBeNull();
});
});