This commit is contained in:
truewhile
2026-10-21 09:19:14 +08:00
parent 7793d50906
commit 3057664a48
3 changed files with 31 additions and 11 deletions
+13
View File
@@ -0,0 +1,13 @@
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')