mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-23 04:46:08 -08:00
Controller: hold to show the secondary subtitle, dictionary entry navigation, standard button names (#312)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af44735bb8
commit
655510cf2e
24 files changed
+609
-33
No files matched your search
@@ -60,6 +60,12 @@ class FakeElement {
|
||||
dataset: Record<string, string> = {};
|
||||
style = new FakeStyleDeclaration();
|
||||
className = '';
|
||||
classes = new Set<string>();
|
||||
classList = {
|
||||
add: (...names: string[]) => names.forEach((name) => this.classes.add(name)),
|
||||
remove: (...names: string[]) => names.forEach((name) => this.classes.delete(name)),
|
||||
contains: (name: string) => this.classes.has(name),
|
||||
};
|
||||
replaceChildrenCalls = 0;
|
||||
src?: string;
|
||||
alt?: string;
|
||||
@@ -726,3 +732,23 @@ test('prepareSecondarySubtitleLines strips ASS override tags and handles empty i
|
||||
assert.deepEqual(prepareSecondarySubtitleLines(''), []);
|
||||
assert.deepEqual(prepareSecondarySubtitleLines('{\\an8}'), []);
|
||||
});
|
||||
|
||||
test('setSecondarySubHeld shows the secondary subtitle while held and restores the chosen mode', () => {
|
||||
withRenderer({}, ({ renderer, dom }) => {
|
||||
const modeClasses = () =>
|
||||
[...dom.secondarySubContainer.classes].filter((name) => name.startsWith('secondary-sub-'));
|
||||
|
||||
renderer.updateSecondarySubMode('hidden');
|
||||
assert.deepEqual(modeClasses(), ['secondary-sub-hidden']);
|
||||
|
||||
renderer.setSecondarySubHeld(true);
|
||||
assert.deepEqual(modeClasses(), ['secondary-sub-visible']);
|
||||
|
||||
// A mode change from mpv or the CLI while held is remembered, not shown yet.
|
||||
renderer.updateSecondarySubMode('hover');
|
||||
assert.deepEqual(modeClasses(), ['secondary-sub-visible']);
|
||||
|
||||
renderer.setSecondarySubHeld(false);
|
||||
assert.deepEqual(modeClasses(), ['secondary-sub-hover']);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user