diff --git a/tests/pages.test.js b/tests/pages.test.js index 3d0a74b..2db014d 100644 --- a/tests/pages.test.js +++ b/tests/pages.test.js @@ -78,7 +78,9 @@ test('pages: the shipped page and dictionaries, with labels shrunk to ids, still for (const [lang, word] of [['en', 'Customers'], ['it', 'Clienti'], ['fr', null]]) { const { ev, errors } = load(lang === 'en' ? { file } : { file, lang, dir }); ev("ACT.start({});S.cash=1e8;ACT.launchBB({city:'fra'});for(let i=0;i<40;i++)dayTick();ACT.leftTab({t:'noc'});renderAll()"); - const text = ev("['hud','leftBody','panelBody','modalCard','toasts'].map(i=>document.getElementById(i)?.textContent||'').join(' ')"); + // Text node by text node: a raw label sits inside one, while two elements' text run together ("facendo." then + // "proprio ora") only looks like one. + const text = ev("['hud','leftBody','panelBody','modalCard','toasts'].map(i=>{const e=document.getElementById(i);if(!e)return '';const w=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),out=[];while(w.nextNode())out.push(w.currentNode.nodeValue);return out.join(' ');}).join(' ')"); if (word) assert.ok(text.includes(word), `${lang}: ${word}`); assert.doesNotMatch(text, /\b[a-z_]+\.[a-z0-9_]{6,}\b/, `${lang}: no raw labels`); assert.equal(ev("tr(FLOOD_WHO[0])"), ev("tr('failures.a_botnet_of_40_000_smart')"), `${lang}: labels kept for saves still translate`);