X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=cbc0b7715f843aa69b4a0ac743fcaf2436265d97;hb=4424bda377336342ce04ab5299bf1ce624cdb7b1;hp=71a501ac52c6578b47bb10b5893e85af80e20aa1;hpb=7481a3645af63cef1406687190fd62bdfb1bf254;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 71a501a..cbc0b77 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1,5 +1,8 @@ module("manipulation"); +// Ensure that an extended Array prototype doesn't break jQuery +Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be called"); }; + var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; @@ -382,13 +385,13 @@ test("append(Function) with incoming value", function() { }); test("append the same fragment with events (Bug #6997, 5566)", function () { - expect(2 + (document.fireEvent ? 1 : 0)); + expect(4 + (document.fireEvent ? 1 : 0)); stop(1000); var element; // This patch modified the way that cloning occurs in IE; we need to make sure that - // native event handlers on the original object don’t get disturbed when they are + // native event handlers on the original object don't get disturbed when they are // modified on the clone if (!jQuery.support.noCloneEvent && document.fireEvent) { element = jQuery("div:first").click(function () { @@ -413,6 +416,14 @@ test("append the same fragment with events (Bug #6997, 5566)", function () { jQuery("#listWithTabIndex li").before(element); jQuery("#listWithTabIndex li.test6997").eq(1).click(); + + element = jQuery(""); + + equals( element.clone().find("option:selected").val(), element.find("option:selected").val(), "Selected option cloned correctly" ); + + element = jQuery("").attr('checked', 'checked'); + + equals( element.clone().is(":checked"), element.is(":checked"), "Checked input cloned correctly" ); }); test("appendTo(String|Element|Array<Element>|jQuery)", function() { @@ -848,7 +859,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() { }); test("clone()", function() { - expect(35); + expect(36); equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' ); var clone = jQuery('#yahoo').clone(); equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' ); @@ -890,7 +901,7 @@ test("clone()", function() { // this is technically an invalid object, but because of the special // classid instantiation it is the only kind that IE has trouble with, - // so let’s test with it too. + // so let's test with it too. div = jQuery("
").html(' '); clone = div.clone(true); @@ -918,6 +929,8 @@ test("clone()", function() { form.appendChild( div ); equals( jQuery(form).clone().children().length, 1, "Make sure we just get the form back." ); + + equal( jQuery("body").clone().children()[0].id, "qunit-header", "Make sure cloning body works" ); }); if (!isLocal) {