1
0

Updates
All checks were successful
Test / test (push) Successful in 9m33s

This commit is contained in:
Aiden
2026-06-11 05:48:19 +10:00
parent a470d4bdc7
commit fbdb733f13
13 changed files with 310 additions and 15 deletions

View File

@@ -0,0 +1,44 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
DEFAULT_MENU_AUTO_HIDE_DELAY_MS,
PLAYING_VIDEO_MENU_AUTO_HIDE_DELAY_MS,
getVideoAwareAutoHideDelayMs,
isVideoActivelyPlaying
} from '../vr180player/utils/control-panel-timing.js';
test('isVideoActivelyPlaying only returns true for non-paused, non-ended video state', () => {
assert.equal(isVideoActivelyPlaying({ paused: false, ended: false }), true);
assert.equal(isVideoActivelyPlaying({ paused: true, ended: false }), false);
assert.equal(isVideoActivelyPlaying({ paused: false, ended: true }), false);
assert.equal(isVideoActivelyPlaying(undefined), false);
});
test('getVideoAwareAutoHideDelayMs uses the shorter delay while video is playing', () => {
assert.equal(
getVideoAwareAutoHideDelayMs({ paused: false, ended: false }),
PLAYING_VIDEO_MENU_AUTO_HIDE_DELAY_MS
);
assert.equal(
getVideoAwareAutoHideDelayMs({ paused: true, ended: false }),
DEFAULT_MENU_AUTO_HIDE_DELAY_MS
);
});
test('getVideoAwareAutoHideDelayMs accepts custom delay values for other control surfaces', () => {
assert.equal(
getVideoAwareAutoHideDelayMs(
{ paused: false, ended: false },
{ idleDelayMs: 3000, playingDelayMs: 1500 }
),
1500
);
assert.equal(
getVideoAwareAutoHideDelayMs(
{ paused: true, ended: false },
{ idleDelayMs: 3000, playingDelayMs: 1500 }
),
3000
);
});