Add is.domElement()

This commit is contained in:
Melvin Philips 2017-10-03 13:25:58 -07:00
parent 27d15f40bd
commit b3903e8ec5
4 changed files with 22 additions and 0 deletions

15
test.js
View file

@ -1,5 +1,6 @@
import util from 'util';
import test from 'ava';
import {JSDOM} from 'jsdom';
import m from '.';
const isNode8orHigher = Number(process.versions.node.split('.')[0]) >= 8;
@ -358,3 +359,17 @@ test('is.inRange', t => {
m.inRange(0, [1, 2, 3]);
});
});
test('is.domElement', t => {
const {document} = (new JSDOM(`...`)).window;
t.true(m.domElement(document.createElement('div')));
t.false(m.domElement('hello world'));
t.false(m.domElement([]));
t.false(m.domElement(new Map()));
t.false(m.domElement(null));
t.false(m.domElement(undefined));
t.false(m.domElement(0));
t.false(m.domElement(NaN));
t.false(m.domElement(Infinity));
t.false(m.domElement({}));
});