aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2019-04-27 09:45:34 +0300
committerMarin Ivanov <[email protected]>2019-04-27 09:45:34 +0300
commitbdf8fce4c2a1a51e1b2996e2dde8c3cf98dc8417 (patch)
treec8385a98095e688c5003b793dc72d4099d245248 /src
parenta9b73cc643471a937eda430b77610579a09c25ce (diff)
Version 1.0.2
Add a repository link to the package.json file. Improve the usage documentation and add ceveats section about once/when. Add a test to ensure the current behaviour of once() and off().
Diffstat (limited to 'src')
-rw-r--r--src/index.test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/index.test.ts b/src/index.test.ts
index af07805..eca7fbb 100644
--- a/src/index.test.ts
+++ b/src/index.test.ts
@@ -81,6 +81,15 @@ describe('nitt#', () => {
inst.emit('foo', 1);
expect(events.foo).toHaveLength(0);
});
+
+ it('should not allow to remove a once handler', () => {
+ let foo = jest.fn();
+ inst.once('foo', foo);
+
+ expect(events.foo).toHaveLength(1);
+ inst.off('foo', foo);
+ expect(events.foo).toHaveLength(1);
+ });
});
describe('when()', () => {