Files
SubMiner/src/settings/settings-field-layout.test.ts
T
sudacode 2b13c82d69 feat(settings): move restart badge inline with option title
- Remove field-meta row (config path, advanced chip) from option rows
- Inline live/restart status badge beside each option label
- Extract getFieldTitleBadges into settings-field-layout module with tests
2026-05-20 01:43:20 -07:00

31 lines
1.0 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import type { ConfigSettingsField } from '../types/settings';
import { getFieldTitleBadges } from './settings-field-layout';
const advancedRestartField: ConfigSettingsField = {
id: 'ankiConnect.knownWords.highlightEnabled',
label: 'Enabled',
description: 'Enable fast local highlighting for words already known in Anki.',
configPath: 'ankiConnect.knownWords.highlightEnabled',
category: 'mining-anki',
section: 'Known Words',
control: 'boolean',
defaultValue: false,
restartBehavior: 'restart',
advanced: true,
};
test('field title badges show restart status without config paths or advanced labels', () => {
const badges = getFieldTitleBadges(advancedRestartField);
assert.deepEqual(badges, [
{
className: 'restart-chip restart',
text: 'Restart',
},
]);
assert.equal(JSON.stringify(badges).includes(advancedRestartField.configPath), false);
assert.equal(JSON.stringify(badges).includes('Advanced'), false);
});