X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=db47856095e3a2f2ce98af219b3b24c083e7f2bb;hb=ad5539bab3e1d6806e054dd5b14cf341a675ded0;hp=794bb5a292c01c30cb7123d4d1dc4b9d0a569bb8;hpb=7d02f06e036f6a42ccd2c276e9f00a7cd35dc74a;p=jquery.git
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js
index 794bb5a..db47856 100644
--- a/src/jquery/coreTest.js
+++ b/src/jquery/coreTest.js
@@ -12,7 +12,7 @@ test("Basic requirements", function() {
});
test("$()", function() {
- expect(2);
+ expect(5);
var main = $("#main");
isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
@@ -29,6 +29,13 @@ test("$()", function() {
pass = false;
}
ok( pass, "$('<tag>') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/
+
+ var code = $("");
+ equals( code.length, 1, "Correct number of elements generated for code" );
+ var img = $("
");
+ equals( img.length, 1, "Correct number of elements generated for img" );
+ var div = $("
");
+ equals( div.length, 4, "Correct number of elements generated for div hr code b" );
});
test("isFunction", function() {
@@ -829,7 +836,7 @@ test("html(String)", function() {
test("filter()", function() {
expect(4);
- isSet( $("input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
+ isSet( $("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
isSet( $("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
isSet( $("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
isSet( $("p").filter(function() { return !$("a", this).length }).get(), q("sndp", "first"), "filter(Function)" );
@@ -842,12 +849,20 @@ test("not()", function() {
isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
});
+test("andSelf()", function() {
+ expect(4);
+ isSet( $("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
+ isSet( $("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
+ isSet( $("#en, #sndp").parent().andSelf().get(), q("foo","en","sndp"), "Check for parent and self" );
+ isSet( $("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
+});
+
test("siblings([String])", function() {
expect(5);
isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
isSet( $("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
isSet( $("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
- isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "floatTest"), "Check for multiple filters" );
+ isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "testForm", "floatTest"), "Check for multiple filters" );
isSet( $("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
});