mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-13 20:56:19 -08:00
fix double-click external playback handling
This commit is contained in:
1 parent
626948f2f5
commit
e350a2ea96
10 files changed
+184
-27
No files matched your search
@@ -0,0 +1,73 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { StreamFormat, VideoPlayer } from 'shared-interfaces';
|
||||
import { SettingsPlaybackSectionComponent } from './settings-playback-section.component';
|
||||
|
||||
describe('SettingsPlaybackSectionComponent', () => {
|
||||
let fixture: ComponentFixture<SettingsPlaybackSectionComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
SettingsPlaybackSectionComponent,
|
||||
NoopAnimationsModule,
|
||||
ReactiveFormsModule,
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SettingsPlaybackSectionComponent);
|
||||
fixture.componentRef.setInput('form', createForm());
|
||||
fixture.componentRef.setInput('activeSection', 'playback');
|
||||
fixture.componentRef.setInput('players', [
|
||||
{
|
||||
id: VideoPlayer.VideoJs,
|
||||
labelKey: 'SETTINGS.PLAYER_VIDEOJS',
|
||||
},
|
||||
{
|
||||
id: VideoPlayer.MPV,
|
||||
labelKey: 'SETTINGS.PLAYER_MPV',
|
||||
},
|
||||
]);
|
||||
fixture.componentRef.setInput('streamFormatEnum', StreamFormat);
|
||||
});
|
||||
|
||||
it('hides the external-player double-click option outside desktop builds', () => {
|
||||
fixture.componentRef.setInput('isDesktop', false);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(
|
||||
fixture.nativeElement.querySelector(
|
||||
'[data-test-id="external-player-double-click-setting"]'
|
||||
)
|
||||
).toBeNull();
|
||||
expect(fixture.nativeElement.textContent).not.toContain(
|
||||
'SETTINGS.OPEN_STREAM_ON_DOUBLE_CLICK'
|
||||
);
|
||||
});
|
||||
|
||||
it('labels the double-click option as external-player behavior on desktop', () => {
|
||||
fixture.componentRef.setInput('isDesktop', true);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(
|
||||
fixture.nativeElement.querySelector(
|
||||
'[data-test-id="external-player-double-click-setting"]'
|
||||
)
|
||||
).not.toBeNull();
|
||||
expect(fixture.nativeElement.textContent).toContain(
|
||||
'SETTINGS.OPEN_EXTERNAL_PLAYER_ON_DOUBLE_CLICK'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function createForm(): FormGroup {
|
||||
return new FormGroup({
|
||||
player: new FormControl(VideoPlayer.VideoJs),
|
||||
streamFormat: new FormControl(StreamFormat.M3u8StreamFormat),
|
||||
openStreamOnDoubleClick: new FormControl(false),
|
||||
showExternalPlaybackBar: new FormControl(true),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user