X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=71b124637f7b4737f7b341dbf9027a79e49990df;hb=cf78e396db1b986360c32fb0ca071a0fb90da064;hp=a0e7b1f846661204e78d66a774385ef0f31fa3b8;hpb=1e9593646f5047cfc5b1754b663e59ec9b73dfce;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index a0e7b1f..71b1246 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1174,7 +1174,7 @@ test("val(String/Number)", function() { var scriptorder = 0; test("html(String)", function() { - expect(11); + expect(13); var div = jQuery("#main > div"); div.html("test"); var pass = true; @@ -1196,6 +1196,10 @@ test("html(String)", function() { jQuery("#main select").html(""); equals( jQuery("#main select").val(), "O2", "Selected option correct" ); + var $div = jQuery('
'); + equals( $div.html( 5 ).html(), '5', 'Setting a number as html' ); + equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' ); + stop(); jQuery("#main").html(''); @@ -1571,13 +1575,18 @@ test("empty()", function() { }); test("slice()", function() { - expect(5); - isSet( jQuery("#ap a").slice(1,2), q("groups"), "slice(1,2)" ); - isSet( jQuery("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" ); - isSet( jQuery("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" ); - isSet( jQuery("#ap a").slice(-1), q("mark"), "slice(-1)" ); + expect(6); + + var $links = jQuery("#ap a"); + + isSet( $links.slice(1,2), q("groups"), "slice(1,2)" ); + isSet( $links.slice(1), q("groups", "anchor1", "mark"), "slice(1)" ); + isSet( $links.slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" ); + isSet( $links.slice(-1), q("mark"), "slice(-1)" ); - isSet( jQuery("#ap a").eq(1), q("groups"), "eq(1)" ); + isSet( $links.eq(1), q("groups"), "eq(1)" ); + + isSet( $links.eq('2'), q("anchor1"), "eq('2')" ); }); test("map()", function() {