wayBetter for X

This commit is contained in:
CRTkafa 2026-10-01 06:01:13 +07:00
commit 2f1e35ba20
720 changed files with 147465 additions and 0 deletions

View file

@ -0,0 +1,20 @@
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');
});