@@ -35,20 +35,24 @@ test("jQuery()", function() {
35
35
"id" : "test3"
36
36
} ;
37
37
38
+ // The $(html, props) signature can stealth-call any $.fn method, check for a
39
+ // few here but beware of modular builds where these methods may be excluded.
38
40
if ( jQuery . fn . width ) {
39
41
expected ++ ;
40
42
attrObj [ "width" ] = 10 ;
41
43
}
42
-
43
44
if ( jQuery . fn . offset ) {
44
45
expected ++ ;
45
46
attrObj [ "offset" ] = { "top" : 1 , "left" : 1 } ;
46
47
}
47
-
48
- if ( jQuery . css ) {
48
+ if ( jQuery . fn . css ) {
49
49
expected += 2 ;
50
50
attrObj [ "css" ] = { "paddingLeft" : 1 , "paddingRight" : 1 } ;
51
51
}
52
+ if ( jQuery . fn . attr ) {
53
+ expected ++ ;
54
+ attrObj . attr = { "desired" : "very" } ;
55
+ }
52
56
53
57
expect ( expected ) ;
54
58
@@ -107,11 +111,15 @@ test("jQuery()", function() {
107
111
equal ( elem [ 0 ] . style . top , "1px" , "jQuery() quick setter offset" ) ;
108
112
}
109
113
110
- if ( jQuery . css ) {
114
+ if ( jQuery . fn . css ) {
111
115
equal ( elem [ 0 ] . style . paddingLeft , "1px" , "jQuery quick setter css" ) ;
112
116
equal ( elem [ 0 ] . style . paddingRight , "1px" , "jQuery quick setter css" ) ;
113
117
}
114
118
119
+ if ( jQuery . fn . attr ) {
120
+ equal ( elem [ 0 ] . getAttribute ( "desired" ) , "very" , "jQuery quick setter attr" ) ;
121
+ }
122
+
115
123
equal ( elem [ 0 ] . childNodes . length , 1 , "jQuery quick setter text" ) ;
116
124
equal ( elem [ 0 ] . firstChild . nodeValue , "test" , "jQuery quick setter text" ) ;
117
125
equal ( elem [ 0 ] . className , "test2" , "jQuery() quick setter class" ) ;
0 commit comments