diff --git a/src/config/config.test.ts b/src/config/config.test.ts index a26f4940..1cd057a4 100644 --- a/src/config/config.test.ts +++ b/src/config/config.test.ts @@ -453,6 +453,30 @@ test('parses subtitleStyle.hoverBackground as a hoverTokenBackgroundColor alias' assert.equal(validService.getConfig().subtitleStyle.hoverTokenBackgroundColor, 'transparent'); }); +test('parses subtitleStyle.hoverTokenBackgroundColor null as invalid instead of missing', () => { + const invalidDir = makeTempDir(); + fs.writeFileSync( + path.join(invalidDir, 'config.jsonc'), + `{ + "subtitleStyle": { + "hoverTokenBackgroundColor": null + } + }`, + 'utf-8', + ); + + const invalidService = new ConfigService(invalidDir); + assert.equal( + invalidService.getConfig().subtitleStyle.hoverTokenBackgroundColor, + DEFAULT_CONFIG.subtitleStyle.hoverTokenBackgroundColor, + ); + assert.ok( + invalidService + .getWarnings() + .some((warning) => warning.path === 'subtitleStyle.hoverTokenBackgroundColor'), + ); +}); + test('parses subtitleStyle.nameMatchEnabled and warns on invalid values', () => { const validDir = makeTempDir(); fs.writeFileSync( diff --git a/src/config/resolve/subtitle-domains.ts b/src/config/resolve/subtitle-domains.ts index 2a77f0f3..26612743 100644 --- a/src/config/resolve/subtitle-domains.ts +++ b/src/config/resolve/subtitle-domains.ts @@ -265,7 +265,9 @@ export function applySubtitleDomainConfig(context: ResolveContext): void { hoverTokenBackgroundColor?: unknown; }; const rawHoverTokenBackgroundColor = - subtitleStyleSource.hoverTokenBackgroundColor ?? subtitleStyleSource.hoverBackground; + subtitleStyleSource.hoverTokenBackgroundColor !== undefined + ? subtitleStyleSource.hoverTokenBackgroundColor + : subtitleStyleSource.hoverBackground; const hoverTokenBackgroundColor = asString(rawHoverTokenBackgroundColor); if (hoverTokenBackgroundColor !== undefined) { resolved.subtitleStyle.hoverTokenBackgroundColor = hoverTokenBackgroundColor;