CI / Build & Quality Checks (push) Skipped
CI / Secret scan (gitleaks) (push) Skipped
CI / Playwright smoke (e2e) (push) Skipped
CI / Build & Quality Checks (pull_request) Successful in 3m44s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 16s
CI / Playwright smoke (e2e) (pull_request) Failing after 23m12s
A search box at the top of the settings sidebar (Ctrl/Cmd+F while settings are open). Results replace the page list while typing, showing the page and section; picking one (or Enter for the top result) opens that page, scrolls to the setting and briefly outlines it. Esc clears. The index is built from the settings source itself (SettingTile titles and descriptions, section headers), loaded as raw text in a lazy chunk on first search, so options added later are found without a hand-kept list. Desktop-only options only show in the desktop app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
66 lines
3.0 KiB
TypeScript
66 lines
3.0 KiB
TypeScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import { parseSettingsSource, searchSettings } from './settingsIndex';
|
|
import { SettingsPages } from '../pages';
|
|
|
|
const general = fs.readFileSync('src/app/features/settings/general/General.tsx', 'utf8');
|
|
const devices = fs.readFileSync('src/app/features/settings/devices/Devices.tsx', 'utf8');
|
|
const sys = fs.readFileSync(
|
|
'src/app/features/settings/notifications/SystemNotification.tsx',
|
|
'utf8',
|
|
);
|
|
const entries = [
|
|
...parseSettingsSource('src/app/features/settings/general/General.tsx', general),
|
|
...parseSettingsSource('src/app/features/settings/devices/Devices.tsx', devices),
|
|
...parseSettingsSource('src/app/features/settings/notifications/SystemNotification.tsx', sys),
|
|
];
|
|
const find = (t: string) => entries.find((e) => e.title === t);
|
|
|
|
test('[#463] indexes the real settings source with the right pages', () => {
|
|
assert.equal(find('Push to deafen')?.page, SettingsPages.CallsPage);
|
|
assert.equal(find('Strip tracking parameters from links')?.page, SettingsPages.DevicesPage);
|
|
assert.equal(find('Page zoom')?.page, SettingsPages.AppearancePage);
|
|
assert.equal(find('Enter for a new line')?.page, SettingsPages.MessagesPage);
|
|
assert.equal(find('Show hidden events')?.page, SettingsPages.DeveloperToolsPage);
|
|
assert.equal(find('Device verification')?.page, SettingsPages.DevicesPage);
|
|
assert.equal(find('Quiet hours')?.page, SettingsPages.NotificationPage);
|
|
assert.equal(find('Launch on login')?.desktopOnly, true);
|
|
assert.match(find('Strip tracking parameters from links')?.description ?? '', /utm_/);
|
|
assert.ok(entries.length > 70, `indexed ${entries.length}`);
|
|
});
|
|
|
|
test('[#463] search: words anywhere, title first, desktop-only hidden in a browser', () => {
|
|
assert.equal(searchSettings(entries, 'deafen')[0]?.title, 'Push to deafen');
|
|
assert.equal(
|
|
searchSettings(entries, 'tracking')[0]?.title,
|
|
'Strip tracking parameters from links',
|
|
);
|
|
assert.equal(searchSettings(entries, 'zoom')[0]?.title, 'Page zoom');
|
|
assert.ok(searchSettings(entries, 'utm').some((e) => e.title.startsWith('Strip tracking')));
|
|
assert.equal(searchSettings(entries, 'launch on login').length, 0);
|
|
assert.equal(
|
|
searchSettings(entries, 'launch on login', { desktop: true })[0]?.title,
|
|
'Launch on login',
|
|
);
|
|
assert.deepEqual(searchSettings(entries, ' '), []);
|
|
});
|
|
|
|
test('[#463] parser handles the attribute forms and skips dynamic titles', () => {
|
|
const src = `
|
|
<Text size="L400">Things</Text>
|
|
<SettingTile title="Plain" description="A & B" after={<Switch value={x} />} />
|
|
<SettingTile title={'Quoted'} description={\`tick\`} />
|
|
<SettingTile title={\`Dynamic \${name}\`} />
|
|
<SettingTile title={someVar} />`;
|
|
const got = parseSettingsSource('src/app/features/settings/about/About.tsx', src);
|
|
assert.deepEqual(
|
|
got.map((e) => [e.title, e.description, e.section]),
|
|
[
|
|
['Plain', 'A & B', 'Things'],
|
|
['Quoted', 'tick', 'Things'],
|
|
['Things', '', undefined],
|
|
],
|
|
);
|
|
});
|