X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=28ba00702907155cb97f00aa21bd01542e401ce7;hb=3362ccf3ddc20d787551ffdb441ae606a3d06630;hp=f736d4d7080e3149ae7cf3e9739415142f596b08;hpb=729396e6cfb1a0495399609f5929fb630a49649d;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index f736d4d..28ba007 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -11,6 +11,11 @@ test("Basic requirements", function() { ok( $, "$()" ); }); +test("$()", function() { + var main = $("#main"); + isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" ); +}); + test("length", function() { ok( $("div").length == 2, "Get Number of Elements Found" ); }); @@ -29,7 +34,7 @@ test("get(Number)", function() { test("add(String|Element|Array)", function() { isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" ); - + isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" ); ok( $([]).add($("#form")[0].elements).length > 13, "Check elements from array" ); var x = $([]).add($("

xxx

")).add($("

xxx

")); @@ -82,8 +87,9 @@ test("attr(String)", function() { }); test("attr(String, Function)", function() { - expect(1); + expect(2); ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" ); + ok( $('#text1').attr('title', function(i) { return i }).attr('title') == "0", "Set value with an index"); }); test("attr(Hash)", function() {