Fix in js/render.js lines 41-45: checks G.dismantleActive || G.dismantleComplete before rendering alignment UI. Regression test passes: 'active Unbuilding suppresses pending alignment event UI' All 10 dismantle tests pass. Closes #122.
2.1 KiB
2.1 KiB
Issue #122 Verification
Status: ✅ ALREADY FIXED
The pending drift alignment UI is properly suppressed during active Unbuilding.
Problem (from issue)
If G.pendingAlignment is still true when the player begins THE UNBUILDING, the normal renderAlignment() path can repaint the Drift alignment choice on top of the dismantle sequence.
Fix
In js/render.js, the renderAlignment() function now checks for active/completed dismantle before rendering alignment UI:
function renderAlignment() {
const container = document.getElementById('alignment-ui');
if (!container) return;
// FIX: Suppress alignment UI during active/completed Unbuilding
if (G.dismantleActive || G.dismantleComplete) {
container.innerHTML = '';
container.style.display = 'none';
return;
}
// ... rest of function
}
Regression Test
Test exists in tests/dismantle.test.cjs:
test('active Unbuilding suppresses pending alignment event UI', () => {
const { G, Dismantle, renderAlignment, document } = loadBeacon({ includeRender: true });
G.pendingAlignment = true;
G.dismantleActive = true;
Dismantle.active = true;
renderAlignment();
assert.equal(document.getElementById('alignment-ui').innerHTML, '');
assert.equal(document.getElementById('alignment-ui').style.display, 'none');
});
Test Results
All 10 tests pass:
✔ tick offers the Unbuilding instead of ending the game immediately
✔ renderAlignment does not wipe the Unbuilding prompt after it is offered
✔ active Unbuilding suppresses pending alignment event UI ← THIS TEST
✔ stage five lasts long enough to dissolve every resource card
✔ save/load restores partial stage-five dissolve progress
✔ deferring the Unbuilding clears the prompt and allows it to return later
✔ defer cooldown survives save and reload
✔ save and load preserve dismantle progress
✔ restore re-renders an offered but not-yet-started Unbuilding prompt
✔ defer cooldown persists after save/load when dismantleTriggered is false
Recommendation
Close issue #122 as already fixed.