aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/browser-gates.js
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-13 17:38:01 -0500
committerCraig Jennings <c@cjennings.net>2026-06-13 17:38:01 -0500
commit603e064e8595bea103c0df3939aa4a4b006309f3 (patch)
tree20378a3067ddac59d3bdf4421907a9ca59ed75bf /scripts/theme-studio/browser-gates.js
parenta0d45cbb48ffe97579a5b4797e48508a8eac4ca4 (diff)
downloaddotemacs-603e064e8595bea103c0df3939aa4a4b006309f3.tar.gz
dotemacs-603e064e8595bea103c0df3939aa4a4b006309f3.zip
Make theme studio column delete safer
Diffstat (limited to 'scripts/theme-studio/browser-gates.js')
-rw-r--r--scripts/theme-studio/browser-gates.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/theme-studio/browser-gates.js b/scripts/theme-studio/browser-gates.js
index eceb11de..cc1b3aaa 100644
--- a/scripts/theme-studio/browser-gates.js
+++ b/scripts/theme-studio/browser-gates.js
@@ -336,8 +336,14 @@ if(location.hash==='#columntest'||location.hash==='#familytest'){let ok=true;con
PALETTE=[['#0d0b0a','bg','ground'],['#f0fef0','fg','ground'],['#c0402a','red','red'],['#3a6ea5','blue','blue'],['#92acc2','blue+1','blue'],['#808080','gray','gray']];
MAP['kw']='#92acc2';lastGone={};selectedIdx=PALETTE.findIndex(p=>p[1]==='blue+1');renderPalette();
const del=document.querySelector('#pals .fstrip[data-column="blue"] .cdel');
- A(!!del,'normal column has a delete button');
+ A(!!del,'normal column has a delete button');
+ const beforeDelete=PALETTE.map(p=>p.join('|')).join('||'),oldConfirm=window.confirm;
+ window.confirm=()=>false;
if(del)del.click();
+ A(PALETTE.map(p=>p.join('|')).join('||')===beforeDelete,'canceling column delete leaves the palette unchanged');
+ window.confirm=()=>true;
+ if(del)del.click();
+ window.confirm=oldConfirm;
A(!PALETTE.some(p=>p[2]==='blue'),'column delete removes every entry with the stable column id');
A(PALETTE.some(p=>p[1]==='red')&&PALETTE.some(p=>p[1]==='gray'),'column delete leaves neighboring columns alone');
A(PALETTE.some(p=>groundRoleOfEntry(p,{bg:MAP['bg'],fg:MAP['p']})==='bg')&&PALETTE.some(p=>groundRoleOfEntry(p,{bg:MAP['bg'],fg:MAP['p']})==='fg'),'column delete leaves ground entries alone');