feat(mobile): settings group their sections by what they reach: your account or this device

A tester could not tell which settings follow the account to every device and which stay on the phone, and looked for offline mode for a while. The section list and dropdown now stand under two headings, "Your account" and "This device". The server the app opens, the app lock and a client certificate move out of Account into a section of their own, "App", shown only in the app, next to Offline; About stands under TREK. Labels in all locales. TestFlight feedback, 5.1.3.
This commit is contained in:
Maurice
2026-11-11 21:31:14 +00:00
parent 948c9ef57b
commit 80c8d9c602
32 changed files with 212 additions and 40 deletions
@@ -1,5 +1,5 @@
// FE-MOB-SET-NAV-001 onwards
import { describe, it, expect, beforeEach } from 'vitest';
import { describe, it, expect, beforeEach, vi } from 'vitest';
import userEvent from '@testing-library/user-event';
import { render, screen } from '../../../helpers/render';
import { resetAllStores, seedStore } from '../../../helpers/store';
@@ -7,6 +7,7 @@ import { buildSettings } from '../../../helpers/factories';
import { useSettingsStore } from '../../../../src/store/settingsStore';
import { usePluginStore } from '../../../../src/store/pluginStore';
import MSettings from '../../../../src/mobile/screens/settings/MSettings';
import * as platform from '../../../../src/native/platform';
describe('MSettings', () => {
beforeEach(() => {
@@ -35,4 +36,36 @@ describe('MSettings', () => {
expect(screen.getByRole('button', { name: /Notifications/ })).toBeInTheDocument();
expect(screen.queryByText('Language & region')).not.toBeInTheDocument();
});
it('FE-MOB-SET-NAV-003: the sections stand under "Your account" and "This device", with Offline on the device', async () => {
const user = userEvent.setup();
render(<MSettings />, { initialEntries: ['/settings'] });
await user.click(screen.getByRole('button', { name: /General/ }));
const account = screen.getByText('Your account');
const device = screen.getByText('This device');
const offline = screen.getByRole('button', { name: 'Offline' });
const accountRow = screen.getByRole('button', { name: 'Account' });
// Account settings first, then what stays on this device.
expect(account.compareDocumentPosition(accountRow) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(accountRow.compareDocumentPosition(device) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(device.compareDocumentPosition(offline) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
// The app's own section exists only in the app.
expect(screen.queryByRole('button', { name: 'App' })).not.toBeInTheDocument();
});
it('FE-MOB-SET-NAV-004: in the app, "App" joins This device', async () => {
const native = vi.spyOn(platform, 'isNativeApp').mockReturnValue(true);
try {
const user = userEvent.setup();
render(<MSettings />, { initialEntries: ['/settings'] });
await user.click(screen.getByRole('button', { name: /General/ }));
const device = screen.getByText('This device');
const app = screen.getByRole('button', { name: 'App' });
expect(device.compareDocumentPosition(app) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
} finally {
native.mockRestore();
}
});
});