X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=test%2Funit%2Fcore.js;h=6bac6309c671cb5afe989daa614bc2913f645156;hb=bf71575bb4f37321b71ef8ce21c8208ad2b192da;hp=e67bc52ff95d4744b119432b0140a22854a3552b;hpb=4bda398e6aa63082c41bb0d06fcc184acd7f76c5;p=jquery.git
diff --git a/test/unit/core.js b/test/unit/core.js
index e67bc52..6bac630 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -310,7 +310,7 @@ test("isXMLDoc - XML", function() {
}
test("jQuery('html')", function() {
- expect(13);
+ expect(15);
reset();
jQuery.foo = false;
@@ -339,6 +339,9 @@ test("jQuery('html')", function() {
ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
ok( !jQuery("")[0].selected, "Make sure that options are auto-selected #2050" );
+
+ ok( jQuery("
")[0], "Create a div with closing tag." );
+ ok( jQuery("")[0], "Create a table with closing tag." );
});
test("jQuery('html', context)", function() {
@@ -436,6 +439,18 @@ test("add(String|Element|Array|undefined)", function() {
ok( jQuery([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );
});
+test("add(String, Context)", function() {
+ expect(6);
+
+ equals( jQuery(document).add("#form").length, 2, "Make sure that using regular context document still works." );
+ equals( jQuery(document.body).add("#form").length, 2, "Using a body context." );
+ equals( jQuery(document.body).add("#html").length, 1, "Using a body context." );
+
+ equals( jQuery(document).add("#form", document).length, 2, "Use a passed in document context." );
+ equals( jQuery(document).add("#form", document.body).length, 2, "Use a passed in body context." );
+ equals( jQuery(document).add("#html", document.body).length, 1, "Use a passed in body context." );
+});
+
test("each(Function)", function() {
expect(1);
var div = jQuery("div");
@@ -538,6 +553,8 @@ test("jQuery.extend(Object, Object)", function() {
same( empty.foo, optionsWithDate.foo, "Dates copy correctly" );
var myKlass = function() {};
+ // Makes the class a little more realistic
+ myKlass.prototype = { someMethod: function(){} };
empty = {};
var optionsWithCustomObject = { foo: { date: new myKlass } };
jQuery.extend(true, empty, optionsWithCustomObject);