feat(player): animate authoritative hedge breakthroughs
This commit is contained in:
@@ -316,6 +316,22 @@ test("hedge edges are canonical, bounded, and deterministic", () => {
|
||||
assert.equal(player.hedgeKeyForMove(0, 2, "east"), "v:1:0");
|
||||
});
|
||||
|
||||
test("breakthrough travel is bounded and starts only from an opened authoritative edge", () => {
|
||||
const css = fs.readFileSync(path.join(project, "web/player.css"), "utf8");
|
||||
const script = fs.readFileSync(path.join(project, "web/player.js"), "utf8");
|
||||
|
||||
assert.match(script, /function breakthroughDirection\(previous, snapshot\)/);
|
||||
assert.match(script, /projectedHedgeEdges\(snapshot\.cells, snapshot\.width\)\.some\(edge => edge\.key === key && edge\.opened\)/);
|
||||
assert.match(script, /if \(direction\) showBreakthroughTravel\(direction\);\n else stopBreakthroughTravel\(\);/);
|
||||
assert.match(script, /for \(let index = 0; index < 4; index\+\+\)/);
|
||||
assert.match(script, /setTimeout\(stopBreakthroughTravel, 480\)/);
|
||||
assert.match(script, /if \(reduced\) stopBreakthroughTravel\(\);/);
|
||||
assert.match(script, /if \(name !== "match"\) stopBreakthroughTravel\(\);/);
|
||||
assert.match(css, /\.breakthrough-runner \{[^}]*pointer-events: none[^}]*480ms/);
|
||||
assert.match(css, /@keyframes breakthrough-run/);
|
||||
assert.match(css, /\[data-reduced-motion="true"\] \.breakthrough-runner/);
|
||||
});
|
||||
|
||||
test("refresh contract restores only the token and waits for server projection", () => {
|
||||
const restore = player.createEnvelope("restore", 1, "restore-1", {token: "0123456789abcdef0123456789abcdef"});
|
||||
assert.deepEqual(Object.keys(restore.payload), ["token"]);
|
||||
|
||||
Reference in New Issue
Block a user