ran npm run tdd & generated TDD
This commit is contained in:
5
test/on/on.js
Normal file
5
test/on/on.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = (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;
|
||||
};
|
||||
13
test/on/on.test.js
Normal file
13
test/on/on.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const on = require('./on.js');
|
||||
|
||||
test('Testing on', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof on === 'function', 'on is a Function');
|
||||
//t.deepEqual(on(args..), 'Expected');
|
||||
//t.equal(on(args..), 'Expected');
|
||||
//t.false(on(args..), 'Expected');
|
||||
//t.throws(on(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user