1
- test ( "jQuery .extend(Object, Object)" , function ( ) {
1
+ test ( "$.widget .extend(Object, Object)" , function ( ) {
2
2
expect ( 28 ) ;
3
3
4
4
var settings = { xnumber1 : 5 , xnumber2 : 7 , xstring1 : "peter" , xstring2 : "pan" } ,
@@ -13,62 +13,62 @@ test("jQuery.extend(Object, Object)", function() {
13
13
arr = [ 1 , 2 , 3 ] ,
14
14
nestedarray = { arr : arr } ;
15
15
16
- jQuery . extend2 ( settings , options ) ;
16
+ $ . widget . extend ( settings , options ) ;
17
17
same ( settings , merged , "Check if extended: settings must be extended" ) ;
18
18
same ( options , optionsCopy , "Check if not modified: options must not be modified" ) ;
19
- jQuery . extend2 ( settings , null , options ) ;
19
+ $ . widget . extend ( settings , null , options ) ;
20
20
same ( settings , merged , "Check if extended: settings must be extended" ) ;
21
21
same ( options , optionsCopy , "Check if not modified: options must not be modified" ) ;
22
22
23
- jQuery . extend2 ( deep1 , deep2 ) ;
23
+ $ . widget . extend ( deep1 , deep2 ) ;
24
24
same ( deep1 . foo , deepmerged . foo , "Check if foo: settings must be extended" ) ;
25
25
same ( deep2 . foo , deep2copy . foo , "Check if not deep2: options must not be modified" ) ;
26
26
equals ( deep1 . foo2 , document , "Make sure that a deep clone was not attempted on the document" ) ;
27
27
28
- ok ( jQuery . extend2 ( { } , nestedarray ) . arr === arr , "Don't clone arrays" ) ;
29
- ok ( jQuery . isPlainObject ( jQuery . extend2 ( { arr : arr } , { arr : { } } ) . arr ) , "Cloned object heve to be an plain object" ) ;
28
+ ok ( $ . widget . extend ( { } , nestedarray ) . arr === arr , "Don't clone arrays" ) ;
29
+ ok ( jQuery . isPlainObject ( $ . widget . extend ( { arr : arr } , { arr : { } } ) . arr ) , "Cloned object heve to be an plain object" ) ;
30
30
31
31
var empty = { } ;
32
32
var optionsWithLength = { foo : { length : - 1 } } ;
33
- jQuery . extend2 ( empty , optionsWithLength ) ;
33
+ $ . widget . extend ( empty , optionsWithLength ) ;
34
34
same ( empty . foo , optionsWithLength . foo , "The length property must copy correctly" ) ;
35
35
36
36
empty = { } ;
37
37
var optionsWithDate = { foo : { date : new Date } } ;
38
- jQuery . extend2 ( empty , optionsWithDate ) ;
38
+ $ . widget . extend ( empty , optionsWithDate ) ;
39
39
same ( empty . foo , optionsWithDate . foo , "Dates copy correctly" ) ;
40
40
41
41
var myKlass = function ( ) { } ;
42
42
var customObject = new myKlass ( ) ;
43
43
var optionsWithCustomObject = { foo : { date : customObject } } ;
44
44
empty = { } ;
45
- jQuery . extend2 ( empty , optionsWithCustomObject ) ;
45
+ $ . widget . extend ( empty , optionsWithCustomObject ) ;
46
46
ok ( empty . foo && empty . foo . date === customObject , "Custom objects copy correctly (no methods)" ) ;
47
47
48
48
// Makes the class a little more realistic
49
49
myKlass . prototype = { someMethod : function ( ) { } } ;
50
50
empty = { } ;
51
- jQuery . extend2 ( empty , optionsWithCustomObject ) ;
51
+ $ . widget . extend ( empty , optionsWithCustomObject ) ;
52
52
ok ( empty . foo && empty . foo . date === customObject , "Custom objects copy correctly" ) ;
53
53
54
- var ret = jQuery . extend2 ( { foo : 4 } , { foo : new Number ( 5 ) } ) ;
54
+ var ret = $ . widget . extend ( { foo : 4 } , { foo : new Number ( 5 ) } ) ;
55
55
ok ( ret . foo == 5 , "Wrapped numbers copy correctly" ) ;
56
56
57
57
var nullUndef ;
58
- nullUndef = jQuery . extend2 ( { } , options , { xnumber2 : null } ) ;
58
+ nullUndef = $ . widget . extend ( { } , options , { xnumber2 : null } ) ;
59
59
ok ( nullUndef . xnumber2 === null , "Check to make sure null values are copied" ) ;
60
60
61
- nullUndef = jQuery . extend2 ( { } , options , { xnumber2 : undefined } ) ;
61
+ nullUndef = $ . widget . extend ( { } , options , { xnumber2 : undefined } ) ;
62
62
ok ( nullUndef . xnumber2 === options . xnumber2 , "Check to make sure undefined values are not copied" ) ;
63
63
64
- nullUndef = jQuery . extend2 ( { } , options , { xnumber0 : null } ) ;
64
+ nullUndef = $ . widget . extend ( { } , options , { xnumber0 : null } ) ;
65
65
ok ( nullUndef . xnumber0 === null , "Check to make sure null values are inserted" ) ;
66
66
67
67
// TODO weird test
68
68
/*
69
69
var target = {};
70
70
var recursive = { foo:target, bar:5 };
71
- jQuery.extend2 (target, recursive);
71
+ $.widget.extend (target, recursive);
72
72
same( target, { bar:5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
73
73
*/
74
74
@@ -106,7 +106,7 @@ test("jQuery.extend(Object, Object)", function() {
106
106
var input = {
107
107
key : [ 1 , 2 , 3 ]
108
108
}
109
- var output = jQuery . extend2 ( { } , input ) ;
109
+ var output = $ . widget . extend ( { } , input ) ;
110
110
deepEqual ( input , output , "don't clone arrays" ) ;
111
111
input . key [ 0 ] = 10 ;
112
112
deepEqual ( input , output , "don't clone arrays" ) ;
0 commit comments