diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2013-05-02 16:35:22 -0400 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2013-05-02 16:35:22 -0400 |
commit | 2406b5e290c1364c0a58832e0bbf4bcf82abfe10 (patch) | |
tree | a1da1c4026fd3318a7ff0cefbbfa152bdd328a0c /test | |
parent | e8b110c646754ffd6f5ee418d7c2ddf4190f9704 (diff) | |
download | jquery-2406b5e290c1364c0a58832e0bbf4bcf82abfe10.tar.gz jquery-2406b5e290c1364c0a58832e0bbf4bcf82abfe10.zip |
Fixes #13850. Better removal of hyphenated data property names.
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/data.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index c2cfe3f3f..1e36ea5c5 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -613,6 +613,35 @@ test(".data supports interoperable removal of hyphenated/camelCase properties", }); }); +test(".data supports interoperable removal of properties SET TWICE #13850", function() { + var div = jQuery("<div>").appendTo("#qunit-fixture"), + datas = { + "non-empty": "a string", + "empty-string": "", + "one-value": 1, + "zero-value": 0, + "an-array": [], + "an-object": {}, + "bool-true": true, + "bool-false": false, + // JSHint enforces double quotes, + // but JSON strings need double quotes to parse + // so we need escaped double quotes here + "some-json": "{ \"foo\": \"bar\" }" + }; + + expect( 9 ); + + jQuery.each( datas, function( key, val ) { + div.data( key, val ); + div.data( key, val ); + + div.removeData( key ); + + equal( div.data( key ), undefined, "removal: " + key ); + }); +}); + test( ".removeData supports removal of hyphenated properties via array (#12786)", function() { expect( 4 ); |