|
|
@@ -5,20 +5,20 @@
|
|
|
|
|
|
/* global document, window */
|
|
|
|
|
|
-import isDomNode from '../../src/dom/isdomnode';
|
|
|
+import isNode from '../../src/dom/isnode';
|
|
|
|
|
|
-describe( 'isDomNode()', () => {
|
|
|
+describe( 'isNode()', () => {
|
|
|
it( 'detects native DOM nodes', () => {
|
|
|
- expect( isDomNode( document ) ).to.be.true;
|
|
|
- expect( isDomNode( document.createElement( 'div' ) ) ).to.be.true;
|
|
|
- expect( isDomNode( document.createTextNode( 'Foo' ) ) ).to.be.true;
|
|
|
-
|
|
|
- expect( isDomNode( {} ) ).to.be.false;
|
|
|
- expect( isDomNode( null ) ).to.be.false;
|
|
|
- expect( isDomNode( undefined ) ).to.be.false;
|
|
|
- expect( isDomNode( new Date() ) ).to.be.false;
|
|
|
- expect( isDomNode( 42 ) ).to.be.false;
|
|
|
- expect( isDomNode( window ) ).to.be.false;
|
|
|
+ expect( isNode( document ) ).to.be.true;
|
|
|
+ expect( isNode( document.createElement( 'div' ) ) ).to.be.true;
|
|
|
+ expect( isNode( document.createTextNode( 'Foo' ) ) ).to.be.true;
|
|
|
+
|
|
|
+ expect( isNode( {} ) ).to.be.false;
|
|
|
+ expect( isNode( null ) ).to.be.false;
|
|
|
+ expect( isNode( undefined ) ).to.be.false;
|
|
|
+ expect( isNode( new Date() ) ).to.be.false;
|
|
|
+ expect( isNode( 42 ) ).to.be.false;
|
|
|
+ expect( isNode( window ) ).to.be.false;
|
|
|
} );
|
|
|
|
|
|
it( 'works for nodes in an iframe', done => {
|
|
|
@@ -27,11 +27,11 @@ describe( 'isDomNode()', () => {
|
|
|
iframe.addEventListener( 'load', () => {
|
|
|
const iframeDocument = iframe.contentWindow.document;
|
|
|
|
|
|
- expect( isDomNode( iframeDocument ) ).to.be.true;
|
|
|
- expect( isDomNode( iframeDocument.createElement( 'div' ) ) ).to.be.true;
|
|
|
- expect( isDomNode( iframeDocument.createTextNode( 'Foo' ) ) ).to.be.true;
|
|
|
+ expect( isNode( iframeDocument ) ).to.be.true;
|
|
|
+ expect( isNode( iframeDocument.createElement( 'div' ) ) ).to.be.true;
|
|
|
+ expect( isNode( iframeDocument.createTextNode( 'Foo' ) ) ).to.be.true;
|
|
|
|
|
|
- expect( isDomNode( iframe.contentWindow ) ).to.be.false;
|
|
|
+ expect( isNode( iframe.contentWindow ) ).to.be.false;
|
|
|
|
|
|
iframe.remove();
|
|
|
done();
|