mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 12:55:20 -07:00
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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user