mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 03:53:07 +00:00
Add test for duplicate events
This commit is contained in:
parent
b5f582ee1a
commit
d5c8a25a08
1 changed files with 13 additions and 0 deletions
|
@ -29,6 +29,19 @@ describe("Emitter", () => {
|
|||
emitter.dispose();
|
||||
});
|
||||
|
||||
it("can unbind duplicate events", () => {
|
||||
const emitter = new Emitter();
|
||||
const callback = () => {
|
||||
throw new Error("should call this");
|
||||
};
|
||||
emitter.on("something", callback);
|
||||
emitter.on("something", callback);
|
||||
emitter.on("something", callback);
|
||||
emitter.off("something", callback);
|
||||
emitter.emit("something");
|
||||
emitter.dispose();
|
||||
});
|
||||
|
||||
it("'off' does nothing if there is no event scheduled", () => {
|
||||
const emitter = new Emitter();
|
||||
const callback = () => {
|
||||
|
|
Loading…
Reference in a new issue