import assert from 'node:assert/strict'; import test from 'node:test'; import { FAB_GAP, fabBottom, fabHidden } from '../src/inject/fabPlacement.ts'; test('wayBetter button: hidden on X photo/video viewer routes and while X shows an overlay', () => { for (const path of ['/CRTkafa/status/2104386004480340154/photo/1', '/jack/status/20/video/1', '/jack/status/20/photo/4/']) { assert.equal(fabHidden(path, false), true, path); } for (const path of ['/home', '/jack/status/20', '/jack/photo', '/i/flow/login', '/jack/media']) { assert.equal(fabHidden(path, false), false, path); } assert.equal(fabHidden('/home', true), true); }); test('wayBetter button: sits above X bottom bar, ignores the empty desktop bar', () => { assert.equal(fabBottom(null, 812), FAB_GAP); assert.equal(fabBottom(812, 812), FAB_GAP, 'zero-height bar at the bottom edge'); assert.equal(fabBottom(759, 812), 53 + FAB_GAP, 'mobile layout bottom bar'); assert.equal(fabBottom(100, 812), FAB_GAP, 'not a bottom bar'); });