jquery core: closes #2968. Simplified isFunction, dropping support for DOM methods...
[jquery.git] / test / unit / core.js
index a0e7b1f..864f77a 100644 (file)
@@ -107,7 +107,7 @@ test("noConflict", function() {
 });\r
 \r
 test("isFunction", function() {\r
-       expect(21);\r
+       expect(19);\r
 \r
        // Make sure that false values return false\r
        ok( !jQuery.isFunction(), "No Value" );\r
@@ -145,7 +145,8 @@ test("isFunction", function() {
        ok( !jQuery.isFunction(obj), "Object Element" );\r
 \r
        // IE says this is an object\r
-       ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );\r
+       // Since 1.3, this isn't supported (#2968)\r
+       //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );\r
 \r
        var nodes = document.body.childNodes;\r
 \r
@@ -162,7 +163,8 @@ test("isFunction", function() {
        document.body.appendChild( input );\r
 \r
        // IE says this is an object\r
-       ok( jQuery.isFunction(input.focus), "A default function property" );\r
+       // Since 1.3, this isn't supported (#2968)\r
+       //ok( jQuery.isFunction(input.focus), "A default function property" );\r
 \r
        document.body.removeChild( input );\r
 \r
@@ -1174,7 +1176,7 @@ test("val(String/Number)", function() {
 var scriptorder = 0;\r
 \r
 test("html(String)", function() {\r
-       expect(11);\r
+       expect(13);\r
        var div = jQuery("#main > div");\r
        div.html("<b>test</b>");\r
        var pass = true;\r
@@ -1196,6 +1198,10 @@ test("html(String)", function() {
        jQuery("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");\r
        equals( jQuery("#main select").val(), "O2", "Selected option correct" );\r
 \r
+       var $div = jQuery('<div />');\r
+       equals( $div.html( 5 ).html(), '5', 'Setting a number as html' );\r
+       equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' );\r
+\r
        stop();\r
 \r
        jQuery("#main").html('<script type="text/javascript">ok( true, "jQuery().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');\r
@@ -1571,13 +1577,18 @@ test("empty()", function() {
 });\r
 \r
 test("slice()", function() {\r
-       expect(5);\r
-       isSet( jQuery("#ap a").slice(1,2), q("groups"), "slice(1,2)" );\r
-       isSet( jQuery("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" );\r
-       isSet( jQuery("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );\r
-       isSet( jQuery("#ap a").slice(-1), q("mark"), "slice(-1)" );\r
+       expect(6);\r
+       \r
+       var $links = jQuery("#ap a");\r
+       \r
+       isSet( $links.slice(1,2), q("groups"), "slice(1,2)" );\r
+       isSet( $links.slice(1), q("groups", "anchor1", "mark"), "slice(1)" );\r
+       isSet( $links.slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );\r
+       isSet( $links.slice(-1), q("mark"), "slice(-1)" );\r
 \r
-       isSet( jQuery("#ap a").eq(1), q("groups"), "eq(1)" );\r
+       isSet( $links.eq(1), q("groups"), "eq(1)" );\r
+       \r
+       isSet( $links.eq('2'), q("anchor1"), "eq('2')" );\r
 });\r
 \r
 test("map()", function() {\r