mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-15 21:33:53 +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();
|
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", () => {
|
it("'off' does nothing if there is no event scheduled", () => {
|
||||||
const emitter = new Emitter();
|
const emitter = new Emitter();
|
||||||
const callback = () => {
|
const callback = () => {
|
||||||
|
|
Loading…
Reference in a new issue