feat(youtube): add mediaCache mode and safer stream media extraction (#130)

This commit is contained in:
2026-06-27 19:20:18 -07:00
committed by GitHub
parent d199376364
commit 5326ad32f5
52 changed files with 4065 additions and 165 deletions
+29
View File
@@ -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();
}
});
+1 -1
View File
@@ -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);
}