source: trip-planner-front/node_modules/events/tests/events-list.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 813 bytes
Line 
1'use strict';
2
3var EventEmitter = require('../');
4var assert = require('assert');
5
6var EE = new EventEmitter();
7var m = function() {};
8EE.on('foo', function() {});
9assert.equal(1, EE.eventNames().length);
10assert.equal('foo', EE.eventNames()[0]);
11EE.on('bar', m);
12assert.equal(2, EE.eventNames().length);
13assert.equal('foo', EE.eventNames()[0]);
14assert.equal('bar', EE.eventNames()[1]);
15EE.removeListener('bar', m);
16assert.equal(1, EE.eventNames().length);
17assert.equal('foo', EE.eventNames()[0]);
18
19if (typeof Symbol !== 'undefined') {
20 var s = Symbol('s');
21 EE.on(s, m);
22 assert.equal(2, EE.eventNames().length);
23 assert.equal('foo', EE.eventNames()[0]);
24 assert.equal(s, EE.eventNames()[1]);
25 EE.removeListener(s, m);
26 assert.equal(1, EE.eventNames().length);
27 assert.equal('foo', EE.eventNames()[0]);
28}
Note: See TracBrowser for help on using the repository browser.