add a test when channel has same handlers subscribed many times
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/16091ff8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/16091ff8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/16091ff8 Branch: refs/heads/master Commit: 16091ff806883b8b638cb9d8486128a3d4582504 Parents: 8d72642 Author: Julien Bouquillon <jul...@bouquillon.com> Authored: Thu May 24 09:15:43 2012 +0200 Committer: Fil Maj <maj....@gmail.com> Committed: Thu May 31 10:27:01 2012 -0700 ---------------------------------------------------------------------- test/test.channel.js | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/16091ff8/test/test.channel.js ---------------------------------------------------------------------- diff --git a/test/test.channel.js b/test/test.channel.js index d998da9..cd86cec 100644 --- a/test/test.channel.js +++ b/test/test.channel.js @@ -74,6 +74,20 @@ describe("channel", function () { c.unsubscribe(thirdHandler); expect(c.numHandlers).toEqual(initialLength - 1); + + c.unsubscribe(firstHandler); + c.unsubscribe(secondHandler); + + expect(c.numHandlers).toEqual(0); + + c.subscribe(firstHandler); + c.subscribe(firstHandler); + + c.unsubscribe(firstHandler); + c.unsubscribe(firstHandler); + + expect(c.numHandlers).toEqual(0); + }); }); });