aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/index_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/index_test.ts b/test/index_test.ts
index ba1dbff..723dfa6 100644
--- a/test/index_test.ts
+++ b/test/index_test.ts
@@ -150,6 +150,17 @@ describe('mitt#', () => {
inst.off('foo', foo);
expect(events.get('foo')).to.deep.equal([]);
});
+
+ it('off("type") should remove all handlers of the given type', () => {
+ inst.on('foo', () => {});
+ inst.on('foo', () => {});
+ inst.on('bar', () => {});
+ inst.off('foo');
+ expect(events.get('foo')).to.deep.equal([]);
+ expect(events.get('bar')).to.have.length(1);
+ inst.off('bar');
+ expect(events.get('bar')).to.deep.equal([]);
+ });
});
describe('emit()', () => {