-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from Ilrilan/master
Fix prependListener in wildcard mode
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var assert= require('assert'); | ||
|
||
var file = '../../lib/eventemitter2'; | ||
var EventEmitter2; | ||
|
||
if(typeof require !== 'undefined') { | ||
EventEmitter2 = require(file).EventEmitter2; | ||
} | ||
else { | ||
EventEmitter2 = window.EventEmitter2; | ||
} | ||
|
||
module.exports= { | ||
'use prepend on wildcards mode': function(){ | ||
var ee = new EventEmitter2({ | ||
wildcard: true | ||
}); | ||
var type = ['some', 'listener', 'bar']; | ||
const function1 = function () {} | ||
const function2 = function () {} | ||
|
||
ee.on(type, function2); | ||
ee.prependListener(type, function1); | ||
assert.deepStrictEqual(ee.listeners(type), [function1, function2]) | ||
} | ||
}; |