diff options
| author | Jason Miller <[email protected]> | 2021-06-22 18:24:42 -0400 |
|---|---|---|
| committer | Jason Miller <[email protected]> | 2021-06-22 18:24:42 -0400 |
| commit | 0cce8fa09eb7f7d359c001a9b711c3369372dcaf (patch) | |
| tree | 2880a3520b7401be904e0f95f079fdaa8c2f7784 /test | |
| parent | 4cce9cb6397af70498525c7b1cc829de2b21edc9 (diff) | |
Add test for #124
Diffstat (limited to 'test')
| -rw-r--r-- | test/index_test.ts | 11 |
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()', () => { |
