fix: events in the 500 ms focus window never touch another agent's draft or queue

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:09:09 +01:00
1 parent d852c406dd
commit dd95bf2c68
3 files changed
+63

No files matched your search

+12
View File
@@ -69,3 +69,15 @@ test("queueLabel for every state", () => {
assert.equal(queueLabel({ state: "uncertain" }), "Nie potwierdzono");
assert.equal(queueLabel({ state: "countdown", left: 2 }), "Wysyłam za 2 s");
});
import { stillSameAgent } from "../mod/ovis-composer/view.js";
test("stillSameAgent: only when the field and the focus are on one agent", () => {
assert.equal(stillSameAgent({ before: "t2", after: "t2", target: "t2" }), true);
// the focus moved to t3 while the field still showed t2: the sync switched the field
assert.equal(stillSameAgent({ before: "t2", after: "t3", target: "t3" }), false);
// the focus is on something that is not an agent
assert.equal(stillSameAgent({ before: "t2", after: "", target: "" }), false);
assert.equal(stillSameAgent({ before: "", after: "", target: "" }), false);
assert.equal(stillSameAgent({ before: "", after: "t2", target: "t2" }), false);
});