diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:50:23 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:50:23 +0200 |
| commit | 5ce0c3b70a58ca2da9084c1e1fbc9f52607fe066 (patch) | |
| tree | 09cf695106fa80a31a5916332cf5bfa7e19c85c5 /tests | |
| parent | a3127187d21b6095db9314fd036b38a95b26df4a (diff) | |
Fix buffer-scoped event delivery
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 38edcda..99674a5 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6998,6 +6998,22 @@ test("Enabled eager events remove overlays and cancel timers", function() end end) +test("MemoryHost limits scoped events to their buffer", function() + local host = MemoryHost.new({ buffer = "buffer-1" }) + local deliveries = 0 + host:register_events("TextChanged", function() + deliveries = deliveries + 1 + end, { buffer = "buffer-1" }) + + host:deliver_event("TextChanged", {}) + same(1, deliveries) + host:set_buffer("buffer-2") + host:deliver_event("TextChanged", {}) + same(1, deliveries) + host:deliver_event("TextChanged", { buffer = "buffer-1" }) + same(2, deliveries) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
