Address review: Reset on All restores defaults verbatim

The Reset handler forced base.enabled = true after copying _ASPECT_DEFAULTS
(where enabled is false) — a leftover from when enabled controlled panel
visibility. Visibility is now independent (Shift+A / ×), so drop the override
and let Reset restore the defaults exactly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
topkoa
2026-07-01 02:59:51 -04:00
co-authored by Claude Opus 4.8
parent 1434eb6342
commit 095d718b85
2 changed files with 10 additions and 3 deletions
+3 -3
View File
@@ -1987,13 +1987,13 @@
b.addEventListener('click', fn); b.addEventListener('click', fn);
return b; return b;
}; };
// Reset: for "All" restores the shared defaults (enabled); for a pane // Reset: for "All" restores the shared defaults exactly; for a pane
// clears that pane's override so it inherits the shared base again. // clears that pane's override so it inherits the shared base again. Panel
// visibility is independent (Shift+A / ×), so Reset doesn't force it open.
btnRow.appendChild(mkBtn('Reset', () => { btnRow.appendChild(mkBtn('Reset', () => {
const base = _aspectTune(); const base = _aspectTune();
if (!_aspectEditTarget) { if (!_aspectEditTarget) {
Object.keys(_ASPECT_DEFAULTS).forEach((k) => { base[k] = _ASPECT_DEFAULTS[k]; }); Object.keys(_ASPECT_DEFAULTS).forEach((k) => { base[k] = _ASPECT_DEFAULTS[k]; });
base.enabled = true;
} else if (base.__panels) { } else if (base.__panels) {
delete base.__panels[_aspectEditTarget]; delete base.__panels[_aspectEditTarget];
} }
+7
View File
@@ -268,6 +268,13 @@ test('opening the panel prunes before the first dropdown build', () => {
); );
}); });
test('Reset on All restores defaults exactly (no forced enabled)', () => {
// Panel visibility is independent of the enabled flag now, so Reset must not
// force enabled true — it should restore _ASPECT_DEFAULTS verbatim.
assert.doesNotMatch(src, /Object\.keys\(_ASPECT_DEFAULTS\)[\s\S]*?base\.enabled\s*=\s*true/,
'Reset must not override the default enabled state');
});
test('the panel has a dismiss (close) control', () => { test('the panel has a dismiss (close) control', () => {
assert.match( assert.match(
src, src,