Skip to content

Commit

Permalink
Add test for #124
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jun 22, 2021
1 parent 4cce9cb commit 0cce8fa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/index_test.ts
Expand Up @@ -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()', () => {
Expand Down

0 comments on commit 0cce8fa

Please sign in to comment.