fix(settings): gate external player choices by launch support

This commit is contained in:
4gray committed 2026-05-22 14:39:20 +03:00
1 parent 959f6061f0
commit 0fb4c7d13e
2 files changed
+42 -1

No files matched your search

@@ -497,6 +497,9 @@ describe('SettingsComponent', () => {
partialBridgeFixture.detectChanges();
expect(partialBridgeComponent.isDesktop).toBe(true);
expect(
partialBridgeComponent.supportsManagedExternalPlayers
).toBe(false);
expect(
partialBridgeComponent.supportsExternalPlayerPathSettings
).toBe(false);
@@ -527,6 +530,44 @@ describe('SettingsComponent', () => {
).toBe(false);
});
it('keeps external player choices when launch support exists without path settings', () => {
fixture.destroy();
window.electron = {
getAppVersion: jest.fn().mockResolvedValue('1.0.0'),
openInMpv: jest.fn(),
openInVlc: jest.fn(),
platform: 'linux',
updateSettings: jest.fn().mockResolvedValue(undefined),
} as unknown as typeof window.electron;
const launchOnlyBridgeFixture =
TestBed.createComponent(SettingsComponent);
const launchOnlyBridgeComponent =
launchOnlyBridgeFixture.componentInstance;
launchOnlyBridgeComponent.checkAppVersion = jest.fn();
launchOnlyBridgeComponent.fetchLocalIpAddresses = jest
.fn()
.mockResolvedValue(undefined);
launchOnlyBridgeFixture.detectChanges();
expect(
launchOnlyBridgeComponent.supportsManagedExternalPlayers
).toBe(true);
expect(
launchOnlyBridgeComponent.supportsExternalPlayerPathSettings
).toBe(false);
expect(
launchOnlyBridgeComponent
.players()
.some((player) => player.id === VideoPlayer.MPV)
).toBe(true);
expect(
launchOnlyBridgeComponent
.players()
.some((player) => player.id === VideoPlayer.VLC)
).toBe(true);
});
it('does not block settings initialization while embedded mpv support is pending', async () => {
let resolveSupport:
| ((value: EmbeddedMpvSupport) => void)
@@ -163,7 +163,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
},
]
: []),
...(this.supportsExternalPlayerPathSettings
...(this.supportsManagedExternalPlayers
? SETTINGS_OS_PLAYER_OPTIONS
: []),
]);