File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -551,3 +551,31 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
551
551
} ) ;
552
552
} ) ;
553
553
554
+ test ( "jQuery.data supports interoperable removal of hyphenated/camelCase properties" , function ( ) {
555
+ var div = jQuery ( "<div/>" , { id : "hyphened" } ) . appendTo ( "#qunit-fixture" ) ,
556
+ datas = {
557
+ "non-empty" : "a string" ,
558
+ "empty-string" : "" ,
559
+ "one-value" : 1 ,
560
+ "zero-value" : 0 ,
561
+ "an-array" : [ ] ,
562
+ "an-object" : { } ,
563
+ "bool-true" : true ,
564
+ "bool-false" : false ,
565
+ "some-json" : '{ "foo": "bar" }'
566
+ } ;
567
+
568
+ expect ( 27 ) ;
569
+
570
+ jQuery . each ( datas , function ( key , val ) {
571
+ div . data ( key , val ) ;
572
+
573
+ deepEqual ( div . data ( key ) , val , "get: " + key ) ;
574
+ deepEqual ( div . data ( jQuery . camelCase ( key ) ) , val , "get: " + jQuery . camelCase ( key ) ) ;
575
+
576
+ div . removeData ( key ) ;
577
+
578
+ equal ( div . data ( key ) , undefined , "get: " + key ) ;
579
+
580
+ } ) ;
581
+ } ) ;
You can’t perform that action at this time.
0 commit comments