Skip to content

Commit 0cce8fa

Browse files
committed
Add test for #124
1 parent 4cce9cb commit 0cce8fa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/index_test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ describe('mitt#', () => {
150150
inst.off('foo', foo);
151151
expect(events.get('foo')).to.deep.equal([]);
152152
});
153+
154+
it('off("type") should remove all handlers of the given type', () => {
155+
inst.on('foo', () => {});
156+
inst.on('foo', () => {});
157+
inst.on('bar', () => {});
158+
inst.off('foo');
159+
expect(events.get('foo')).to.deep.equal([]);
160+
expect(events.get('bar')).to.have.length(1);
161+
inst.off('bar');
162+
expect(events.get('bar')).to.deep.equal([]);
163+
});
153164
});
154165

155166
describe('emit()', () => {

0 commit comments

Comments
 (0)