Added support for .contents(). Returns ALL child nodes for an element - except for...
[jquery.git] / src / jquery / coreTest.js
index e919284..d673711 100644 (file)
@@ -976,3 +976,30 @@ test("slice()", function() {
        isSet( $("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );
        isSet( $("#ap a").slice(-1), q("mark"), "slice(-1)" );
 });
+
+test("map()", function() {
+       expect(2);
+
+       isSet(
+               $("#ap").map(function(){
+                       return $(this).find("a").get();
+               }),
+               q("google", "groups", "anchor1", "mark"),
+               "Array Map"
+       );
+
+       isSet(
+               $("#ap > a").map(function(){
+                       return this.parentNode;
+               }),
+               q("ap","ap","ap"),
+               "Single Map"
+       );
+});
+
+test("contents()", function() {
+       expect(3);
+       equals( $("#ap").contents().length, 9, "Check element contents" );
+       ok( $("#iframe").contents()[0], "Check existance of IFrame document" );
+       ok( $("#iframe").contents()[0].body, "Check existance of IFrame body" );
+});