From 97c328dce66af289e4186d6cde1fbcf85f78ab0a Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 30 Oct 2026 18:35:01 +0100 Subject: [PATCH] Tests: the #219 panel check lives in the #219 test, #69 untouched --- tests/issues.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/issues.test.js b/tests/issues.test.js index 0530fa9..ea3ac01 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -970,8 +970,7 @@ test('#69 embedded caches can sit in either metro building, so one dark building assert.equal(up(), 1); assert.equal(ev("R.useCache[S.caches.find(x=>x.site==='a').id]||0"), 0, 'the box in the dark building carries nothing'); assert.ok(ev("R.useCache[S.caches.find(x=>x.site==='b').id]||0") > 0, 'the box in B still serves'); - ev("selectCity('fra');ACT.tab({t:'peer'})"); - assert.equal(ev(`[...document.querySelectorAll('[data-act=siteSet].pink')].filter(b=>JSON.parse(b.dataset.args).k==='p').map(b=>JSON.parse(b.dataset.args).s).join()`), 'ab', 'Both is shown as chosen'); + ev("UI.sel={type:'city',id:'fra'};UI.tab='peer';renderPanel()"); assert.match(ev("$('panelBody').textContent"), /Boxes: 1 in A ยท 1 in B/); // old saves: caches without a site are in A; dropping the second site moves them back ev("delete S.caches[0].site;S=migrate(JSON.parse(JSON.stringify(S)))"); @@ -1359,6 +1358,8 @@ test('#219 splitting a one-member PNI across both sites splits it when the augme ev("ACT.siteSet({k:'p',id:'x',s:'ab'})"); assert.equal(ev('S.cash'), paid); // the panel shows Both as chosen meanwhile + ev("selectCity('fra');ACT.tab({t:'peer'})"); + assert.equal(ev(`[...document.querySelectorAll('[data-act=siteSet].pink')].filter(b=>JSON.parse(b.dataset.args).k==='p').map(b=>JSON.parse(b.dataset.args).s).join()`), 'ab', 'Both is shown as chosen'); assert.equal(ev("(()=>{const m=siteCtl('p','x','fra',S.pni[0].up&&S.pni[0].up.site==='ab'?'ab':S.pni[0].site).match(/]*class=\"[^\"]*pink[^>]*>(.*?)<\\/button>/);return m&&m[1].includes(tr('common.site'))?'':m&&m[1]})()").startsWith('Both'), true); // survives a save and load ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()');