@@ -184,9 +184,10 @@ test(".data(String) and .data(String, Object)", function() {
184
184
} ) ;
185
185
186
186
test ( "data-* attributes" , function ( ) {
187
- expect ( 33 ) ;
187
+ expect ( 37 ) ;
188
188
var div = jQuery ( "<div>" ) ,
189
- child = jQuery ( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>" ) ;
189
+ child = jQuery ( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>" ) ,
190
+ dummy = jQuery ( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>" ) ;
190
191
191
192
equals ( div . data ( "attr" ) , undefined , "Check for non-existing data-attr attribute" ) ;
192
193
@@ -208,10 +209,11 @@ test("data-* attributes", function() {
208
209
child . data ( "ignored" , "cache" ) ;
209
210
equals ( child . data ( "ignored" ) , "cache" , "Cached data used before DOM data-* fallback" ) ;
210
211
211
- var obj = child . data ( ) , check = [ "myobj" , "ignored" , "other" ] , num = 0 ;
212
+ var obj = child . data ( ) , obj2 = dummy . data ( ) , check = [ "myobj" , "ignored" , "other" ] , num = 0 , num2 = 0 ;
212
213
213
214
for ( var i = 0 , l = check . length ; i < l ; i ++ ) {
214
215
ok ( obj [ check [ i ] ] , "Make sure data- property exists when calling data-." ) ;
216
+ ok ( obj2 [ check [ i ] ] , "Make sure data- property exists when calling data-." ) ;
215
217
}
216
218
217
219
for ( var prop in obj ) {
@@ -220,6 +222,12 @@ test("data-* attributes", function() {
220
222
221
223
equals ( num , check . length , "Make sure that the right number of properties came through." ) ;
222
224
225
+ for ( var prop in obj2 ) {
226
+ num2 ++ ;
227
+ }
228
+
229
+ equals ( num2 , check . length , "Make sure that the right number of properties came through." ) ;
230
+
223
231
child . attr ( "data-other" , "newvalue" ) ;
224
232
225
233
equals ( child . data ( "other" ) , "test" , "Make sure value was pulled in properly from a .data()." ) ;
0 commit comments