forked from WikiDeck/wikideck
[ui-a] Fix: results card explains on-topic tie-breaks #51
@@ -14,7 +14,7 @@ export function Results({ result, modeName, onRematch, onLobby }: { result: Resu
|
||||
: `You won ${won} of ${result.lanes.length} Topics${tiebreak ? ', so total power decided it' : ''}.`}</p>
|
||||
<ol className="result-lanes">
|
||||
{result.lanes.map(l => <li key={l.name} className={l.winner === 0 ? 'won' : l.winner === 1 ? 'lost' : 'tied'}>
|
||||
<span>{l.name}</span><b>{l.myPower} – {l.theirPower}</b><small>{l.winner === 0 ? 'Won' : l.winner === 1 ? 'Lost' : 'Tied'}</small>
|
||||
<span>{l.name}</span><b>{l.myPower} – {l.theirPower}</b><small>{l.winner === 0 ? 'Won' : l.winner === 1 ? 'Lost' : 'Tied'}</small>{l.winner !== null && l.myPower === l.theirPower && <small className="tie-note">Tie, decided by on-topic cards</small>}
|
||||
</li>)}
|
||||
</ol>
|
||||
<p className="muted small">Matches are off-chain. No card was moved or burned.</p>
|
||||
|
||||
@@ -206,3 +206,4 @@ html.wd-in-match .auth-wrap,body:has(.match) .auth-wrap{display:none}
|
||||
.show-narrow{display:none}
|
||||
@media(max-width:480px){.show-narrow{display:inline}.play-actions .button{min-width:0}}
|
||||
.lane-bonus{color:var(--ctp-yellow)!important;margin-left:2px}
|
||||
.result-lanes .tie-note{font-size:10px;color:var(--ctp-yellow);line-height:1.3}
|
||||
|
||||
@@ -141,3 +141,14 @@ test('the final board shows scoring power, and queued cards preview their lane p
|
||||
assert.equal(q.power, q.basePower + q.trend + bonus);
|
||||
}
|
||||
});
|
||||
|
||||
test('results explain a tied Topic decided by the on-topic tie-break', async () => {
|
||||
const { renderToStaticMarkup } = await import('react-dom/server');
|
||||
const { createElement } = await import('react');
|
||||
const { Results } = await import('../src/game/Results.tsx');
|
||||
const html = renderToStaticMarkup(createElement(Results, { modeName: 'Standard', onRematch() {}, onLobby() {}, result: {
|
||||
winner: 1, turns: 6, reason: 'topics', totalPower: [37, 42],
|
||||
lanes: [{ name: 'Current Events', myPower: 13, theirPower: 13, winner: 1 }, { name: 'Archive', myPower: 10, theirPower: 10, winner: 0 },
|
||||
{ name: 'Stub', myPower: 14, theirPower: 19, winner: 1 }] } }));
|
||||
assert.equal(html.match(/Tie, decided by on-topic cards/g)?.length, 2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user