增加晶全app静态页面
This commit is contained in:
48
node_modules/event-emitter/test/all-off.js
generated
vendored
Normal file
48
node_modules/event-emitter/test/all-off.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
var ee = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x, count, count2;
|
||||
|
||||
x = ee();
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
x.on('foo', function () {
|
||||
++count;
|
||||
});
|
||||
x.on('foo', function () {
|
||||
++count;
|
||||
});
|
||||
x.on('bar', function () {
|
||||
++count2;
|
||||
});
|
||||
x.on('bar', function () {
|
||||
++count2;
|
||||
});
|
||||
t(x, 'foo');
|
||||
x.emit('foo');
|
||||
x.emit('bar');
|
||||
a(count, 0, "All off: type");
|
||||
a(count2, 2, "All off: ohter type");
|
||||
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
x.on('foo', function () {
|
||||
++count;
|
||||
});
|
||||
x.on('foo', function () {
|
||||
++count;
|
||||
});
|
||||
x.on('bar', function () {
|
||||
++count2;
|
||||
});
|
||||
x.on('bar', function () {
|
||||
++count2;
|
||||
});
|
||||
t(x);
|
||||
x.emit('foo');
|
||||
x.emit('bar');
|
||||
a(count, 0, "All off: type");
|
||||
a(count2, 0, "All off: other type");
|
||||
};
|
14
node_modules/event-emitter/test/emit-error.js
generated
vendored
Normal file
14
node_modules/event-emitter/test/emit-error.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var customError = require('es5-ext/error/custom')
|
||||
, ee = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x, error = customError('Some error', 'ERROR_TEST'), emitted;
|
||||
|
||||
x = ee();
|
||||
a.throws(function () { t.call(x, error); }, 'ERROR_TEST');
|
||||
x.on('error', function (err) { emitted = err; });
|
||||
t.call(x, error);
|
||||
a(emitted, error);
|
||||
};
|
42
node_modules/event-emitter/test/has-listeners.js
generated
vendored
Normal file
42
node_modules/event-emitter/test/has-listeners.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'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");
|
||||
}
|
||||
};
|
||||
};
|
107
node_modules/event-emitter/test/index.js
generated
vendored
Normal file
107
node_modules/event-emitter/test/index.js
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
'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");
|
||||
};
|
53
node_modules/event-emitter/test/pipe.js
generated
vendored
Normal file
53
node_modules/event-emitter/test/pipe.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var ee = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {}, y = {}, z = {}, count, count2, count3, pipe;
|
||||
|
||||
ee(x);
|
||||
x = Object.create(x);
|
||||
ee(y);
|
||||
ee(z);
|
||||
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
count3 = 0;
|
||||
x.on('foo', function () {
|
||||
++count;
|
||||
});
|
||||
y.on('foo', function () {
|
||||
++count2;
|
||||
});
|
||||
z.on('foo', function () {
|
||||
++count3;
|
||||
});
|
||||
|
||||
x.emit('foo');
|
||||
a(count, 1, "Pre pipe, x");
|
||||
a(count2, 0, "Pre pipe, y");
|
||||
a(count3, 0, "Pre pipe, z");
|
||||
|
||||
pipe = t(x, y);
|
||||
x.emit('foo');
|
||||
a(count, 2, "Post pipe, x");
|
||||
a(count2, 1, "Post pipe, y");
|
||||
a(count3, 0, "Post pipe, z");
|
||||
|
||||
y.emit('foo');
|
||||
a(count, 2, "Post pipe, on y, x");
|
||||
a(count2, 2, "Post pipe, on y, y");
|
||||
a(count3, 0, "Post pipe, on y, z");
|
||||
|
||||
t(x, z);
|
||||
x.emit('foo');
|
||||
a(count, 3, "Post pipe z, x");
|
||||
a(count2, 3, "Post pipe z, y");
|
||||
a(count3, 1, "Post pipe z, z");
|
||||
|
||||
pipe.close();
|
||||
x.emit('foo');
|
||||
a(count, 4, "Close pipe y, x");
|
||||
a(count2, 3, "Close pipe y, y");
|
||||
a(count3, 2, "Close pipe y, z");
|
||||
};
|
123
node_modules/event-emitter/test/unify.js
generated
vendored
Normal file
123
node_modules/event-emitter/test/unify.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
'use strict';
|
||||
|
||||
var ee = require('../');
|
||||
|
||||
module.exports = function (t) {
|
||||
|
||||
return {
|
||||
"": function (a) {
|
||||
var x = {}, y = {}, z = {}, count, count2, count3;
|
||||
|
||||
ee(x);
|
||||
ee(y);
|
||||
ee(z);
|
||||
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
count3 = 0;
|
||||
x.on('foo', function () { ++count; });
|
||||
y.on('foo', function () { ++count2; });
|
||||
z.on('foo', function () { ++count3; });
|
||||
|
||||
x.emit('foo');
|
||||
a(count, 1, "Pre unify, x");
|
||||
a(count2, 0, "Pre unify, y");
|
||||
a(count3, 0, "Pre unify, z");
|
||||
|
||||
t(x, y);
|
||||
a(x.__ee__, y.__ee__, "Post unify y");
|
||||
x.emit('foo');
|
||||
a(count, 2, "Post unify, x");
|
||||
a(count2, 1, "Post unify, y");
|
||||
a(count3, 0, "Post unify, z");
|
||||
|
||||
y.emit('foo');
|
||||
a(count, 3, "Post unify, on y, x");
|
||||
a(count2, 2, "Post unify, on y, y");
|
||||
a(count3, 0, "Post unify, on y, z");
|
||||
|
||||
t(x, z);
|
||||
a(x.__ee__, x.__ee__, "Post unify z");
|
||||
x.emit('foo');
|
||||
a(count, 4, "Post unify z, x");
|
||||
a(count2, 3, "Post unify z, y");
|
||||
a(count3, 1, "Post unify z, z");
|
||||
},
|
||||
"On empty": function (a) {
|
||||
var x = {}, y = {}, z = {}, count, count2, count3;
|
||||
|
||||
ee(x);
|
||||
ee(y);
|
||||
ee(z);
|
||||
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
count3 = 0;
|
||||
y.on('foo', function () { ++count2; });
|
||||
x.emit('foo');
|
||||
a(count, 0, "Pre unify, x");
|
||||
a(count2, 0, "Pre unify, y");
|
||||
a(count3, 0, "Pre unify, z");
|
||||
|
||||
t(x, y);
|
||||
a(x.__ee__, y.__ee__, "Post unify y");
|
||||
x.on('foo', function () { ++count; });
|
||||
x.emit('foo');
|
||||
a(count, 1, "Post unify, x");
|
||||
a(count2, 1, "Post unify, y");
|
||||
a(count3, 0, "Post unify, z");
|
||||
|
||||
y.emit('foo');
|
||||
a(count, 2, "Post unify, on y, x");
|
||||
a(count2, 2, "Post unify, on y, y");
|
||||
a(count3, 0, "Post unify, on y, z");
|
||||
|
||||
t(x, z);
|
||||
a(x.__ee__, z.__ee__, "Post unify z");
|
||||
z.on('foo', function () { ++count3; });
|
||||
x.emit('foo');
|
||||
a(count, 3, "Post unify z, x");
|
||||
a(count2, 3, "Post unify z, y");
|
||||
a(count3, 1, "Post unify z, z");
|
||||
},
|
||||
Many: function (a) {
|
||||
var x = {}, y = {}, z = {}, count, count2, count3;
|
||||
|
||||
ee(x);
|
||||
ee(y);
|
||||
ee(z);
|
||||
|
||||
count = 0;
|
||||
count2 = 0;
|
||||
count3 = 0;
|
||||
x.on('foo', function () { ++count; });
|
||||
y.on('foo', function () { ++count2; });
|
||||
y.on('foo', function () { ++count2; });
|
||||
z.on('foo', function () { ++count3; });
|
||||
|
||||
x.emit('foo');
|
||||
a(count, 1, "Pre unify, x");
|
||||
a(count2, 0, "Pre unify, y");
|
||||
a(count3, 0, "Pre unify, z");
|
||||
|
||||
t(x, y);
|
||||
a(x.__ee__, y.__ee__, "Post unify y");
|
||||
x.emit('foo');
|
||||
a(count, 2, "Post unify, x");
|
||||
a(count2, 2, "Post unify, y");
|
||||
a(count3, 0, "Post unify, z");
|
||||
|
||||
y.emit('foo');
|
||||
a(count, 3, "Post unify, on y, x");
|
||||
a(count2, 4, "Post unify, on y, y");
|
||||
a(count3, 0, "Post unify, on y, z");
|
||||
|
||||
t(x, z);
|
||||
a(x.__ee__, x.__ee__, "Post unify z");
|
||||
x.emit('foo');
|
||||
a(count, 4, "Post unify z, x");
|
||||
a(count2, 6, "Post unify z, y");
|
||||
a(count3, 1, "Post unify z, z");
|
||||
}
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user