Test scope opacity, the Visual reset and the panel's presets

The share codec carries field 30 and still encodes a link made before it
to the same code; the long form writes sco only below full opacity; the
mask fades without repainting; the panel shows and sets the opacity, and
the reset and the presets call their actions.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-14 15:31:33 -08:00
1 parent 471151910d
commit 6c1744e55b
6 files changed
+294 -1

No files matched your search

+23
View File
@@ -121,6 +121,29 @@ test('scope feather above 100% survives share parsing and serialization', () =>
clearTimeout(manager._debounceTimer);
});
test('scope opacity rides as sco only below full, and through the compact link', () => {
// Links without `sco`, every link made before it, open at full opacity.
assert.equal(makeManager('#v=2&lat=10&lon=20&scf=35').parseInitialHash().scopeOpacityPct, 100);
assert.equal(makeManager('#v=2&lat=10&lon=20&sco=40').parseInitialHash().scopeOpacityPct, 40);
assert.equal(makeManager('#v=2&lat=10&lon=20&sco=250').parseInitialHash().scopeOpacityPct, 100);
assert.equal(makeManager('#v=2&lat=10&lon=20&sco=-3').parseInitialHash().scopeOpacityPct, 0);
assert.equal(makeManager('#v=2&lat=10&lon=20&sco=x').parseInitialHash().scopeOpacityPct, 100);
const manager = makeManager();
manager.onToggleChange(false, true, {});
const before = manager._buildHashParams().toString();
assert.equal(manager._buildHashParams().has('sco'), false, 'full opacity writes nothing');
manager.onToggleChange(false, true, { scopeOpacityPct: 100 });
assert.equal(manager._buildHashParams().toString(), before);
manager.onToggleChange(false, true, { scopeOpacityPct: 45.4 });
assert.equal(manager._buildHashParams().get('sco'), '45');
assert.equal(sharedState(manager.buildLink()).scopeOpacityPct, 45);
manager.onToggleChange(false, true, { scopeOpacityPct: 100 });
assert.equal(manager._buildHashParams().has('sco'), false);
assert.equal(sharedState(manager.buildLink()).scopeOpacityPct, 100);
clearTimeout(manager._debounceTimer);
});
test('share-link serialization emits the current celestial state', () => {
const manager = makeManager();
manager.onToggleChange(false, false, { celestialRingEnabled: false });