Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/tests/filterNotifier.js

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/tests/filterListener.js ('k') | chrome/content/tests/filterStorage_readwrite.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ];
11 11
12 function compareListeners(test, list) 12 function compareListeners(test, list)
13 { 13 {
14 let result1 = triggeredListeners = []; 14 let result1 = triggeredListeners = [];
15 FilterNotifier.triggerListeners("foo", {bar: true}); 15 FilterNotifier.triggerListeners("foo", {bar: true});
16 16
17 let result2 = triggeredListeners = []; 17 let result2 = triggeredListeners = [];
18 for each (let observer in list) 18 for (let observer of list)
19 observer("foo", {bar: true}); 19 observer("foo", {bar: true});
20 20
21 deepEqual(result1, result2, test); 21 deepEqual(result1, result2, test);
22 } 22 }
23 23
24 test("Adding/removing listeners", function() 24 test("Adding/removing listeners", function()
25 { 25 {
26 let [listener1, listener2, listener3] = listeners; 26 let [listener1, listener2, listener3] = listeners;
27 27
28 compareListeners("No listeners", []); 28 compareListeners("No listeners", []);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 FilterNotifier.removeListener(listener1); 66 FilterNotifier.removeListener(listener1);
67 }; 67 };
68 let listener2 = listeners[1]; 68 let listener2 = listeners[1];
69 FilterNotifier.addListener(listener1); 69 FilterNotifier.addListener(listener1);
70 FilterNotifier.addListener(listener2); 70 FilterNotifier.addListener(listener2);
71 71
72 compareListeners("Initial call", [listener1, listener2]); 72 compareListeners("Initial call", [listener1, listener2]);
73 compareListeners("Subsequent calls", [listener2]); 73 compareListeners("Subsequent calls", [listener2]);
74 }); 74 });
75 })(); 75 })();
OLDNEW
« no previous file with comments | « chrome/content/tests/filterListener.js ('k') | chrome/content/tests/filterStorage_readwrite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld