feat: add animated choice modes and bracket editor
Verify mini program and deploy preview / verify-deploy (push) Successful in 50s

This commit is contained in:
2026-09-19 04:11:21 +08:00
parent 90ac8b951f
commit 36aee09dfa
39 changed files with 1669 additions and 178 deletions
+25
View File
@@ -0,0 +1,25 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const bracket = require('../utils/bracket');
function candidates(count) {
return Array.from({ length: count }, (_, index) => ({ id: String(index), name: `C${index}` }));
}
test('supports selecting several matches in the same round', () => {
const state = bracket.create(candidates(4));
assert.equal(bracket.chooseAt(state, 1, state.matches[1].right), false);
assert.equal(state.round, 1);
assert.equal(bracket.chooseAt(state, 0, state.matches[0].left), false);
assert.equal(state.round, 2);
assert.equal(bracket.choose(state, state.matches[0].left), true);
assert.equal(state.pool.length, 1);
assert.equal(state.decisions.length, 3);
});
test('odd candidates receive a deterministic bye', () => {
const state = bracket.create(candidates(3));
bracket.chooseAt(state, 0, state.matches[0].left);
assert.equal(state.round, 2);
assert.equal(state.matches[0].right.id, '2');
});