mirror of
https://github.com/truewhile/MeBox.git
synced 2026-11-15 20:34:23 +08:00
14 lines
787 B
TypeScript
14 lines
787 B
TypeScript
import { shouldShowPlayerDiagnostics } from './playerPageModel.ts'
|
|
|
|
function check(name: string, actual: boolean, expected: boolean) {
|
|
if (actual !== expected) throw new Error(`playerDiagnostics: ${name}`)
|
|
}
|
|
|
|
check('hidden by default and during normal playback', shouldShowPlayerDiagnostics('', ''), false)
|
|
check('visible when playback fails', shouldShowPlayerDiagnostics('视频播放失败', ''), true)
|
|
check('visible when media cannot be loaded', shouldShowPlayerDiagnostics('', '无法加载该媒体'), true)
|
|
check('visible when both loading and playback fail', shouldShowPlayerDiagnostics('视频播放失败', '无法加载该媒体'), true)
|
|
check('hidden again after errors are cleared', shouldShowPlayerDiagnostics('', ''), false)
|
|
|
|
console.log('playerDiagnostics.test.ts ok')
|