Fix issue #84: Double click token
All checks were successful
Test / test (push) Successful in 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 20:44:53 +00:00
parent 2c1cc970e6
commit 5ee7353123
3 changed files with 25 additions and 3 deletions

View File

@@ -341,6 +341,17 @@ function mapViewerTokenWiringTests() {
assert.match(pane, /@contextmenu\.stop\.prevent="onTokenContextMenu\(token\)"/);
});
test("double clicking a token opens its actor's character sheet", () => {
assert.match(pane, /@dblclick="openTokenSheet\(token\)"/);
// The sheet is opened for the actor behind the token, and only when that actor is known.
assert.match(pane, /function openTokenSheet\(token\) \{[^}]*tokenActor\(token\)[^}]*openActorSheet\(/);
// A single click is not the trigger: it lands on the token at the end of every drag, so
// moving a token would open its sheet every time.
assert.doesNotMatch(pane, /@click="openTokenSheet\(/);
// The keyboard reaches the same sheet: Enter on a focused token, like its arrow keys.
assert.match(pane, /if \(event\.key === 'Enter'\) openTokenSheet\(token\);/);
});
test("tokens are saved and taken off through the map routes", () => {
assert.match(pane, /['"]\/map\/place-token['"]/);
assert.match(pane, /['"]\/map\/remove-token['"]/);