X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=8cd1aee9a91b66d31f65c5ffd75709f9031f483b;hb=77bb2c505f1d2c4437f4b52866408f8bd1a5020f;hp=412ba39c354bde17d7f03d3c9dde1abac9e12247;hpb=291f071eff51bc0653aaf3dcfd777cc57437ebdf;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 412ba39..8cd1aee 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1562,8 +1562,8 @@ test("contents()", function() { equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" ); }); -test("makeArray(#2619)", function(){ - expect(11); +test("$.makeArray", function(){ + expect(13); equals( $.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" ); @@ -1577,14 +1577,18 @@ test("makeArray(#2619)", function(){ equals( $.makeArray( "foo" )[0], "foo", "Pass makeArray a string" ); - equals( typeof $.makeArray( true )[0], "boolean", "Pass makeArray a boolean" ); + equals( $.makeArray( true )[0].constructor, Boolean, "Pass makeArray a boolean" ); equals( $.makeArray( document.createElement("div") )[0].nodeName, "DIV", "Pass makeArray a single node" ); equals( $.makeArray( {length:2, 0:"a", 1:"b"} ).join(""), "ab", "Pass makeArray an array like map (with length)" ); - equals( $.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "HEAD", "Pass makeArray a childNodeson array" ); + equals( $.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "HEAD", "Pass makeArray a childNodes array" ); - //function (tricky, they have length) - equals( $.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" ); + //function, is tricky as it has length + equals( $.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" ); + //window, also has length + equals( $.makeArray(window)[0], window, "Pass makeArray the window" ); + + equals( $.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" ); }); \ No newline at end of file