Files
ytplayer/frontend/bento-hub.test.js
2026-10-04 03:09:15 +08:00

13 lines
868 B
JavaScript

const test=require('node:test'),assert=require('node:assert/strict');
const {chromeClearance}=require('./bento-hub');
test('clearance follows the highest visible floating control, including safe area',()=>{
assert.equal(chromeClearance(844,[{visible:true,fixed:true,top:746,height:98},{visible:true,fixed:true,top:666,height:72},{visible:true,fixed:true,top:602,height:56}]),258);
});
test('hidden and scrolling content cannot reserve fullscreen bottom space',()=>{
assert.equal(chromeClearance(844,[{visible:false,fixed:true,top:602,height:56},{visible:true,fixed:false,top:500,height:100},{visible:true,fixed:true,top:0,height:64}]),16);
});
test('desktop mini player reserves its real height and margin; no chrome is 16px',()=>{
assert.equal(chromeClearance(844,[{visible:true,fixed:true,top:760,height:72}]),100);
assert.equal(chromeClearance(844,[]),16);
});