Sha256: c7569db2262b858aa29322d156352cdcb06186aeeffda305a4781bbdd0294291

Contents?: true

Size: 1.31 KB

Versions: 67

Compression:

Stored size: 1.31 KB

Contents

'use strict';

var ee = require('../');

module.exports = function (t) {
	var x, y;
	return {
		Any: function (a) {
			a(t(true), false, "Primitive");
			a(t({ events: [] }), false, "Other object");
			a(t(x = ee()), false, "Emitter: empty");

			x.on('test', y = function () {});
			a(t(x), true, "Emitter: full");
			x.off('test', y);
			a(t(x), false, "Emitter: empty but touched");
			x.once('test', y = function () {});
			a(t(x), true, "Emitter: full: Once");
			x.off('test', y);
			a(t(x), false, "Emitter: empty but touched by once");
		},
		Specific: function (a) {
			a(t(true, 'test'), false, "Primitive");
			a(t({ events: [] }, 'test'), false, "Other object");
			a(t(x = ee(), 'test'), false, "Emitter: empty");

			x.on('test', y = function () {});
			a(t(x, 'test'), true, "Emitter: full");
			a(t(x, 'foo'), false, "Emitter: full, other event");
			x.off('test', y);
			a(t(x, 'test'), false, "Emitter: empty but touched");
			a(t(x, 'foo'), false, "Emitter: empty but touched, other event");

			x.once('test', y = function () {});
			a(t(x, 'test'), true, "Emitter: full: Once");
			a(t(x, 'foo'), false, "Emitter: full: Once,  other event");
			x.off('test', y);
			a(t(x, 'test'), false, "Emitter: empty but touched by once");
			a(t(x, 'foo'), false, "Emitter: empty but touched by once, other event");
		}
	};
};

Version data entries

67 entries across 60 versions & 8 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.21.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.20.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.19.1 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.19.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.18.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.17.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.16.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.15.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.14.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.13.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.12.2 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.12.1 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.12.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.11.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.10.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.9.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.8.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.7.0 node_modules/event-emitter/test/has-listeners.js
govuk_publishing_components-17.6.1 node_modules/event-emitter/test/has-listeners.js