Files
ytplayer/frontend/glass-panel-layout.test.js

11 lines
782 B
JavaScript

const { test } = require('node:test');
const assert = require('node:assert/strict');
const { bottomClearance } = require('./glass-panel-layout.js');
test('clearance covers stacked floating chrome and includes its viewport inset once', () => {
assert.equal(bottomClearance(844, [{ fixed: true, top: 740, bottom: 844, height: 104 }, { fixed: true, top: 668, bottom: 732, height: 64 }]), 192);
assert.equal(bottomClearance(844, [{ fixed: true, top: 740, bottom: 844, height: 104 }]), 120);
});
test('hidden, nonfixed and offscreen elements do not reserve chrome space', () => {
assert.equal(bottomClearance(844, [{ fixed: true, top: 740, bottom: 844, height: 0 }, { fixed: false, top: 668, bottom: 732, height: 64 }, { fixed: true, top: 900, bottom: 964, height: 64 }]), 0);
});