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

Unified Diff: test/filterNotifier.js

Issue 29977555: Issue 7202 - Add hasListeners method to EventEmitter (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add tests Created Jan. 9, 2019, 5 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/events.js ('K') | « lib/events.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterNotifier.js
===================================================================
--- a/test/filterNotifier.js
+++ b/test/filterNotifier.js
@@ -45,16 +45,22 @@
function removeListener(listener)
{
filterNotifier.off("foo", listener);
}
function compareListeners(test, testDescription, list)
{
+ test.equal(filterNotifier.hasListeners(), list.length > 0, testDescription);
+ test.equal(filterNotifier.hasListeners("foo"), list.length > 0,
+ testDescription);
+
+ test.equal(filterNotifier.hasListeners("bar"), false, testDescription);
+
let result1 = triggeredListeners = [];
filterNotifier.emit("foo", {bar: true});
let result2 = triggeredListeners = [];
for (let observer of list)
observer({bar: true});
test.deepEqual(result1, result2, testDescription);
« lib/events.js ('K') | « lib/events.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld