mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 00:55:16 -07:00
fix: address follow-up review feedback
This commit is contained in:
@@ -140,8 +140,8 @@ export function renderMpvKeybindingsInput(
|
||||
removeButton.type = 'button';
|
||||
removeButton.textContent = 'Remove';
|
||||
removeButton.addEventListener('click', () => {
|
||||
rows.splice(i, 1);
|
||||
applyMpvRows(context, field, rows);
|
||||
const nextRows = rows.filter((_, index) => index !== i);
|
||||
applyMpvRows(context, field, nextRows);
|
||||
requestRender();
|
||||
});
|
||||
item.append(keyButton, command, removeButton);
|
||||
|
||||
@@ -87,6 +87,27 @@ test('filterSettingsFields normalizes punctuation in query terms', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('filterSettingsFields preserves non-Latin query terms', () => {
|
||||
const japaneseFields: ConfigSettingsField[] = [
|
||||
{
|
||||
id: 'subtitleStyle.japaneseFontFamily',
|
||||
label: '日本語フォント',
|
||||
description: '字幕の表示に使う書体。',
|
||||
configPath: 'subtitleStyle.japaneseFontFamily',
|
||||
category: 'appearance',
|
||||
section: 'Primary Subtitle Appearance',
|
||||
control: 'text',
|
||||
defaultValue: '',
|
||||
restartBehavior: 'hot-reload',
|
||||
},
|
||||
];
|
||||
|
||||
assert.deepEqual(
|
||||
filterSettingsFields(japaneseFields, { query: '日本語' }).map((field) => field.configPath),
|
||||
['subtitleStyle.japaneseFontFamily'],
|
||||
);
|
||||
});
|
||||
|
||||
test('settings draft tracks dirty set and emits save operations', () => {
|
||||
const draft = createSettingsDraft({
|
||||
'subtitleStyle.autoPauseVideoOnHover': true,
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface SettingsDraft {
|
||||
}
|
||||
|
||||
function normalizeQuery(query: string | undefined): string {
|
||||
return (query ?? '').trim().toLowerCase();
|
||||
return (query ?? '').trim().toLocaleLowerCase();
|
||||
}
|
||||
|
||||
function searchableText(parts: Array<string | undefined>): string {
|
||||
@@ -25,8 +25,8 @@ function searchableText(parts: Array<string | undefined>): string {
|
||||
.filter(Boolean)
|
||||
.join(' ')
|
||||
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
||||
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
||||
.toLowerCase();
|
||||
.replace(/[^\p{L}\p{N}]+/gu, ' ')
|
||||
.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
function valuesEqual(a: unknown, b: unknown): boolean {
|
||||
|
||||
Reference in New Issue
Block a user