aboutsummaryrefslogtreecommitdiff
path: root/node_modules/event-emitter/test/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/event-emitter/test/index.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/event-emitter/test/index.js')
-rw-r--r--node_modules/event-emitter/test/index.js107
1 files changed, 0 insertions, 107 deletions
diff --git a/node_modules/event-emitter/test/index.js b/node_modules/event-emitter/test/index.js
deleted file mode 100644
index c7c3f24c4..000000000
--- a/node_modules/event-emitter/test/index.js
+++ /dev/null
@@ -1,107 +0,0 @@
-'use strict';
-
-module.exports = function (t, a) {
- var x = t(), y, count, count2, count3, count4, test, listener1, listener2;
-
- x.emit('none');
-
- test = "Once: ";
- count = 0;
- x.once('foo', function (a1, a2, a3) {
- a(this, x, test + "Context");
- a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments");
- ++count;
- });
-
- x.emit('foobar');
- a(count, 0, test + "Not invoked on other event");
- x.emit('foo', 'foo', x, 15);
- a(count, 1, test + "Emitted");
- x.emit('foo');
- a(count, 1, test + "Emitted once");
-
- test = "On & Once: ";
- count = 0;
- x.on('foo', listener1 = function (a1, a2, a3) {
- a(this, x, test + "Context");
- a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments");
- ++count;
- });
- count2 = 0;
- x.once('foo', listener2 = function (a1, a2, a3) {
- a(this, x, test + "Context");
- a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments");
- ++count2;
- });
-
- x.emit('foobar');
- a(count, 0, test + "Not invoked on other event");
- x.emit('foo', 'foo', x, 15);
- a(count, 1, test + "Emitted");
- x.emit('foo', 'foo', x, 15);
- a(count, 2, test + "Emitted twice");
- a(count2, 1, test + "Emitted once");
- x.off('foo', listener1);
- x.emit('foo');
- a(count, 2, test + "Not emitter after off");
-
- count = 0;
- x.once('foo', listener1 = function () { ++count; });
-
- x.off('foo', listener1);
- x.emit('foo');
- a(count, 0, "Once Off: Not emitted");
-
- count = 0;
- x.on('foo', listener2 = function () {});
- x.once('foo', listener1 = function () { ++count; });
-
- x.off('foo', listener1);
- x.emit('foo');
- a(count, 0, "Once Off (multi): Not emitted");
- x.off('foo', listener2);
-
- test = "Prototype Share: ";
-
- y = Object.create(x);
-
- count = 0;
- count2 = 0;
- count3 = 0;
- count4 = 0;
- x.on('foo', function () {
- ++count;
- });
- y.on('foo', function () {
- ++count2;
- });
- x.once('foo', function () {
- ++count3;
- });
- y.once('foo', function () {
- ++count4;
- });
- x.emit('foo');
- a(count, 1, test + "x on count");
- a(count2, 0, test + "y on count");
- a(count3, 1, test + "x once count");
- a(count4, 0, test + "y once count");
-
- y.emit('foo');
- a(count, 1, test + "x on count");
- a(count2, 1, test + "y on count");
- a(count3, 1, test + "x once count");
- a(count4, 1, test + "y once count");
-
- x.emit('foo');
- a(count, 2, test + "x on count");
- a(count2, 1, test + "y on count");
- a(count3, 1, test + "x once count");
- a(count4, 1, test + "y once count");
-
- y.emit('foo');
- a(count, 2, test + "x on count");
- a(count2, 2, test + "y on count");
- a(count3, 1, test + "x once count");
- a(count4, 1, test + "y once count");
-};