Left: | ||
Right: |
OLD | NEW |
---|---|
1 (function() | 1 (function() |
2 { | 2 { |
3 module("Filter notifier", {setup: prepareFilterComponents, teardown: restoreFi lterComponents}); | 3 module("Filter notifier", {setup: prepareFilterComponents, teardown: restoreFi lterComponents}); |
4 | 4 |
5 let triggeredListeners = []; | 5 let triggeredListeners = []; |
6 let listeners = [ | 6 let listeners = [ |
7 function(action, item) triggeredListeners.push(["listener1", action, item]), | 7 function(action, item) triggeredListeners.push(["listener1", action, item]), |
8 function(action, item) triggeredListeners.push(["listener2", action, item]), | 8 function(action, item) triggeredListeners.push(["listener2", action, item]), |
9 function(action, item) triggeredListeners.push(["listener3", action, item]) | 9 function(action, item) triggeredListeners.push(["listener3", action, item]) |
10 ]; | 10 ]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 | 50 |
51 FilterNotifier.removeListener(listener3); | 51 FilterNotifier.removeListener(listener3); |
52 compareListeners("removeListener(listener3)", [listener2, listener1]); | 52 compareListeners("removeListener(listener3)", [listener2, listener1]); |
53 | 53 |
54 FilterNotifier.removeListener(listener1); | 54 FilterNotifier.removeListener(listener1); |
55 compareListeners("removeListener(listener1)", [listener2]); | 55 compareListeners("removeListener(listener1)", [listener2]); |
56 | 56 |
57 FilterNotifier.removeListener(listener2); | 57 FilterNotifier.removeListener(listener2); |
58 compareListeners("removeListener(listener2)", []); | 58 compareListeners("removeListener(listener2)", []); |
59 }); | 59 }); |
60 | |
61 test("Removing listeners while being called", function() | |
62 { | |
63 let listener1 = function(){ | |
Thomas Greiner
2014/04/07 08:30:49
Nit: Move bracket to new line
| |
64 listeners[0].apply(this, arguments); | |
65 FilterNotifier.removeListener(listener1); | |
66 }; | |
67 let listener2 = listeners[1]; | |
68 FilterNotifier.addListener(listener1); | |
69 FilterNotifier.addListener(listener2); | |
70 | |
71 compareListeners("Initial call", [listener1, listener2]); | |
72 compareListeners("Subsequent calls", [listener2]); | |
73 }) | |
Thomas Greiner
2014/04/07 08:30:49
Nit: Missing semicolon
| |
60 })(); | 74 })(); |
OLD | NEW |