@@ -643,7 +643,7 @@ test("jQuery.merge()", function() {
643
643
} ) ;
644
644
645
645
test ( "jQuery.extend(Object, Object)" , function ( ) {
646
- expect ( 25 ) ;
646
+ expect ( 27 ) ;
647
647
648
648
var settings = { xnumber1 : 5 , xnumber2 : 7 , xstring1 : "peter" , xstring2 : "pan" } ,
649
649
options = { xnumber2 : 1 , xstring2 : "x" , xxx : "newstring" } ,
@@ -653,7 +653,9 @@ test("jQuery.extend(Object, Object)", function() {
653
653
deep1copy = { foo : { bar : true } } ,
654
654
deep2 = { foo : { baz : true } , foo2 : document } ,
655
655
deep2copy = { foo : { baz : true } , foo2 : document } ,
656
- deepmerged = { foo : { bar : true , baz : true } , foo2 : document } ;
656
+ deepmerged = { foo : { bar : true , baz : true } , foo2 : document } ,
657
+ arr = [ 1 , 2 , 3 ] ,
658
+ nestedarray = { arr : arr } ;
657
659
658
660
jQuery . extend ( settings , options ) ;
659
661
same ( settings , merged , "Check if extended: settings must be extended" ) ;
@@ -668,6 +670,9 @@ test("jQuery.extend(Object, Object)", function() {
668
670
same ( deep2 . foo , deep2copy . foo , "Check if not deep2: options must not be modified" ) ;
669
671
equals ( deep1 . foo2 , document , "Make sure that a deep clone was not attempted on the document" ) ;
670
672
673
+ ok ( jQuery . extend ( true , [ ] , arr ) !== arr , "Deep extend of array must clone array" ) ;
674
+ ok ( jQuery . extend ( true , { } , nestedarray ) . arr !== arr , "Deep extend of object must clone child array" ) ;
675
+
671
676
var empty = { } ;
672
677
var optionsWithLength = { foo : { length : - 1 } } ;
673
678
jQuery . extend ( true , empty , optionsWithLength ) ;
0 commit comments