mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 12:55:16 -07:00
fix: clear stale CSS properties and subtitle state on style/media update
- Remove CSS properties absent from subsequent subtitle style updates - Broadcast subtitle:set clear when media path changes - Preserve launcher lifecycle ownership for already-managed overlay apps - Clamp negative autoplay current time to zero - Reject blank subminerBinaryPath values via parseNonEmptyString - Log and rethrow legacy config migration errors instead of swallowing - Normalize modifier aliases (e.g. CommandOrControl) in keybinding display
This commit is contained in:
@@ -45,6 +45,12 @@ class FakeStyleDeclaration {
|
||||
setProperty(name: string, value: string) {
|
||||
this.values.set(name, value);
|
||||
}
|
||||
|
||||
removeProperty(name: string) {
|
||||
const previous = this.values.get(name) ?? '';
|
||||
this.values.delete(name);
|
||||
return previous;
|
||||
}
|
||||
}
|
||||
|
||||
class FakeElement {
|
||||
@@ -475,6 +481,57 @@ test('applySubtitleStyle applies primary and secondary css declaration objects',
|
||||
}
|
||||
});
|
||||
|
||||
test('applySubtitleStyle removes css declarations missing from later updates', () => {
|
||||
const restoreDocument = installFakeDocument();
|
||||
try {
|
||||
const subtitleRoot = new FakeElement('div');
|
||||
const subtitleContainer = new FakeElement('div');
|
||||
const secondarySubRoot = new FakeElement('div');
|
||||
const secondarySubContainer = new FakeElement('div');
|
||||
const ctx = {
|
||||
state: createRendererState(),
|
||||
dom: {
|
||||
subtitleRoot,
|
||||
subtitleContainer,
|
||||
secondarySubRoot,
|
||||
secondarySubContainer,
|
||||
},
|
||||
} as never;
|
||||
|
||||
const renderer = createSubtitleRenderer(ctx);
|
||||
renderer.applySubtitleStyle({
|
||||
css: {
|
||||
'font-size': '42px',
|
||||
'text-wrap': 'balance',
|
||||
},
|
||||
secondary: {
|
||||
css: {
|
||||
'text-transform': 'uppercase',
|
||||
},
|
||||
},
|
||||
} as never);
|
||||
renderer.applySubtitleStyle({
|
||||
css: {
|
||||
'font-size': '44px',
|
||||
},
|
||||
secondary: {
|
||||
css: {},
|
||||
},
|
||||
} as never);
|
||||
|
||||
const primaryValues = (subtitleRoot.style as unknown as { values?: Map<string, string> })
|
||||
.values;
|
||||
const secondaryValues = (secondarySubRoot.style as unknown as { values?: Map<string, string> })
|
||||
.values;
|
||||
|
||||
assert.equal(primaryValues?.get('font-size'), '44px');
|
||||
assert.equal(primaryValues?.has('text-wrap'), false);
|
||||
assert.equal(secondaryValues?.has('text-transform'), false);
|
||||
} finally {
|
||||
restoreDocument();
|
||||
}
|
||||
});
|
||||
|
||||
test('annotated subtitle tokens inherit configured base subtitle typography', () => {
|
||||
const restoreDocument = installFakeDocument();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user