From 5098597cb14df8a0be9249fcabbdf5b6d126cd85 Mon Sep 17 00:00:00 2001 From: Mario Schlicht Date: Tue, 18 Jan 2022 08:01:58 +0100 Subject: Add parameter "options" to EventTarget.off() - additional: Typescript-Interfaces for off() functions updated --- spec/spec/types/EventTarget.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec') diff --git a/spec/spec/types/EventTarget.js b/spec/spec/types/EventTarget.js index e27a71c..82e5a94 100644 --- a/spec/spec/types/EventTarget.js +++ b/spec/spec/types/EventTarget.js @@ -101,6 +101,17 @@ describe('EventTarget.js', () => { target.dispatch('event') expect(spy.calls.count()).toBe(1) }) + + it('removes an event binding with options from the target', () => { + const target = new EventTarget() + const spy = createSpy() + target.on('event', spy, undefined, { capture: true }) + target.dispatch('event') + expect(spy.calls.count()).toBe(1) + target.off('event', spy, { capture: true }) + target.dispatch('event') + expect(spy.calls.count()).toBe(1) + }) }) describe('on()', () => { -- cgit v1.2.3