mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 04:46:07 -08:00
feat(youtube): add mediaCache mode and safer stream media extraction (#130)
This commit is contained in:
1 parent
d199376364
commit
5326ad32f5
52 files changed
+4065
-165
No files matched your search
@@ -93,3 +93,32 @@ test('select controls show config-only current values without offering them othe
|
||||
restoreDocument();
|
||||
}
|
||||
});
|
||||
|
||||
test('select controls use configured option labels', () => {
|
||||
const restoreDocument = installDocumentStub();
|
||||
try {
|
||||
const field = {
|
||||
...createSelectField(),
|
||||
enumValues: ['direct', 'background'],
|
||||
enumLabels: {
|
||||
direct: 'Direct stream extraction',
|
||||
background: 'Background media cache',
|
||||
},
|
||||
} as ConfigSettingsField & { enumLabels: Record<string, string> };
|
||||
|
||||
const control = renderControl(field, {
|
||||
valueForField: () => 'direct',
|
||||
valueForPath: () => undefined,
|
||||
updateDraft: () => {},
|
||||
resetDraftPath: () => {},
|
||||
setFieldError: () => {},
|
||||
}) as HTMLSelectElement;
|
||||
|
||||
assert.deepEqual(
|
||||
Array.from(control.options).map((option) => option.textContent),
|
||||
['Direct stream extraction', 'Background media cache'],
|
||||
);
|
||||
} finally {
|
||||
restoreDocument();
|
||||
}
|
||||
});
|
||||
@@ -227,7 +227,7 @@ export function renderControl(
|
||||
for (const enumValue of enumValues) {
|
||||
const option = createElement('option') as HTMLOptionElement;
|
||||
option.value = enumValue;
|
||||
option.textContent = enumValue;
|
||||
option.textContent = field.enumLabels?.[enumValue] ?? enumValue;
|
||||
option.selected = enumValue === value;
|
||||
select.append(option);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user