Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
6
test/on/on.js
Normal file
6
test/on/on.js
Normal file
@ -0,0 +1,6 @@
|
||||
const on = (el, evt, fn, opts = {}) => {
|
||||
const delegatorFn = e => e.target.matches(opts.target) && fn.call(e.target, e);
|
||||
el.addEventListener(evt, opts.target ? delegatorFn : fn, opts.options || false);
|
||||
if (opts.target) return delegatorFn;
|
||||
};
|
||||
module.exports = on;
|
||||
10
test/on/on.test.js
Normal file
10
test/on/on.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
const expect = require('expect');
|
||||
const on = require('./on.js');
|
||||
|
||||
|
||||
test('on is a Function', () => {
|
||||
expect(on).toBeInstanceOf(Function);
|
||||
});
|
||||
t.pass('Tested by @chalarangelo on 16/02/2018');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user