Charters: tests follow the popup, the tutorial waits only for a picker on screen
The tutorial waited for a charter whenever one was due, also where the picker is not shown (seeded tests); it now waits only while the picker is open. Two tests still read the old wording for own subsea cables (level 9 or Tier 1 now), and the route fuzz signs the classic charter on both pages when a normal game starts, so neither shows charter buttons the other has not.
This commit is contained in:
parent
934a83588a
commit
50e0119497
3 changed files with 6 additions and 3 deletions
|
|
@ -95,6 +95,9 @@ function playGame(pages, seed, opts = {}) {
|
|||
const [s0, s1] = both('start', st);
|
||||
same('start', s0, s1);
|
||||
note('start ' + JSON.stringify(st));
|
||||
// A normal game signs its charter first: a popup on newer pages (which seeded pages skip), a card on older ones. Both
|
||||
// sign the classic one at once, so neither shows charter buttons the other has not, and the game plays as it did.
|
||||
if (kind === 'normal') { const [c0, c1] = both('press', { act: 'charter', args: { k: 'global' } }); same('charter', c0, c1); }
|
||||
if (!div) compare('start');
|
||||
|
||||
// A screen's buttons on both pages; the same list or a divergence.
|
||||
|
|
|
|||
|
|
@ -55,4 +55,4 @@ function beginGame(nm,city,o={}){if(needPitch()&&!UI.pitched){UI.pendGame=[nm,ci
|
|||
track('game_new');UI.started=true;closeModal();compute();cam.x=CITY[city].x;cam.y=CITY[city].y;cam.z=innerWidth<760?1.1:1.4;selectCity(city);
|
||||
toast(S.scn?`<b>${esc(S.scn.name)}</b><br>${o.scn.goal?esc(o.scn.goal)+'.':tr('common.serve_as_much_traffic_as_you')} ${tr('scenarios.you_have_n_days',{n:S.scn.days})}`:S.mode==='sandbox'?(chaosMul()?tr('scenarios.sandbox_mode_a_billion_dollars_chaos',{chaos:CHAOS[rule('chaos')].n}):tr('scenarios.sandbox_mode_a_billion_dollars_every')):tr('scenarios.welcome_name_the_ripe_ncc_assigned',{name:esc(nm),asn:S.asn,city:CITY[city].name}),'goal');
|
||||
// A Normal game asks for its charter first; the tutorial starts once it is signed.
|
||||
renderAll();save();if(!S.scn&&S.mode!=='sandbox'&&S.mode!=='puzzle'){if(charterDue()){UI.tutLater=true;charterAsk();}else tutorialStart();}}
|
||||
renderAll();save();if(!S.scn&&S.mode!=='sandbox'&&S.mode!=='puzzle'){charterAsk();if(!$('modal').hidden&&$('modal').className==='charter')UI.tutLater=true;else tutorialStart();}}
|
||||
|
|
|
|||
|
|
@ -410,9 +410,9 @@ test('#22 Tier 1 networks can lay their own subsea cable', () => {
|
|||
const { ev, dom, errors } = load();
|
||||
ev("ACT.start({});S.cash=2e8;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});ACT.buildPop({city:'lon'});ACT.buildPop({city:'nyc'});compute()");
|
||||
const card = () => dom.window.document.getElementById('modalCard').textContent;
|
||||
// not before Tier 1
|
||||
// not before Tier 1 or customer level 9 (#300)
|
||||
ev("UI.lmode='df';UI.via=null;openLinkModal('lon','nyc')");
|
||||
assert.match(card(), /Tier 1 only/);
|
||||
assert.match(card(), /level 9 or Tier 1/);
|
||||
assert.match(ev("ownCabWhy('lon','nyc')"), /Tier 1/);
|
||||
ev('ACT.orderCable()');
|
||||
assert.equal(ev("S.links.filter(l=>l.own&&l.sub).length"), 0, 'refused before Tier 1');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue