diff options
author | Nilton Cesar <niltoncms@gmail.com> | 2017-11-22 14:43:44 -0500 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-01-08 11:21:22 -0500 |
commit | 64a289286a743516bce82462200062a647ef3ac0 (patch) | |
tree | a98de0017aa21c031f59d1b21bd9ccea01a66f8d /test/unit | |
parent | 3c0f2cfb05c94adb164ac863a96eb2cf09e8110a (diff) | |
download | jquery-64a289286a743516bce82462200062a647ef3ac0.tar.gz jquery-64a289286a743516bce82462200062a647ef3ac0.zip |
Core: make camelCase function available only for internal usage
Close gh-3604
Fixes gh-3384
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/core.js | 19 | ||||
-rw-r--r-- | test/unit/data.js | 13 | ||||
-rw-r--r-- | test/unit/deprecated.js | 19 |
3 files changed, 24 insertions, 27 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 3229f78d5..276830ace 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1683,25 +1683,6 @@ QUnit.test( "jQuery.parseXML", function( assert ) { } } ); -QUnit.test( "jQuery.camelCase()", function( assert ) { - - var tests = { - "foo-bar": "fooBar", - "foo-bar-baz": "fooBarBaz", - "girl-u-want": "girlUWant", - "the-4th-dimension": "the-4thDimension", - "-o-tannenbaum": "OTannenbaum", - "-moz-illa": "MozIlla", - "-ms-take": "msTake" - }; - - assert.expect( 7 ); - - jQuery.each( tests, function( key, val ) { - assert.equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val ); - } ); -} ); - testIframe( "Conditional compilation compatibility (#13274)", "core/cc_on.html", diff --git a/test/unit/data.js b/test/unit/data.js index 248878eda..5824c2f9d 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -602,7 +602,7 @@ QUnit.test( ".data should not miss attr() set data-* with hyphenated property na } ); QUnit.test( ".data always sets data with the camelCased key (gh-2257)", function( assert ) { - assert.expect( 18 ); + assert.expect( 9 ); var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ), datas = { @@ -625,7 +625,6 @@ QUnit.test( ".data always sets data with the camelCased key (gh-2257)", function div.data( key, val ); var allData = div.data(); assert.equal( allData[ key ], undefined, ".data does not store with hyphenated keys" ); - assert.equal( allData[ jQuery.camelCase( key ) ], val, ".data stores the camelCased key" ); } ); } ); @@ -639,7 +638,7 @@ QUnit.test( ".data should not strip more than one hyphen when camelCasing (gh-20 assert.equal( allData[ "nested--Triple" ], "triple", "Key with triple hyphens is correctly camelCased" ); } ); -QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function( assert ) { +QUnit.test( ".data supports interoperable hyphenated get/set of properties with arbitrary non-null|NaN|undefined values", function( assert ) { var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ), datas = { @@ -661,17 +660,16 @@ QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of proper "2-num-start": true }; - assert.expect( 24 ); + assert.expect( 12 ); jQuery.each( datas, function( key, val ) { div.data( key, val ); assert.deepEqual( div.data( key ), val, "get: " + key ); - assert.deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) ); } ); } ); -QUnit.test( ".data supports interoperable removal of hyphenated/camelCase properties", function( assert ) { +QUnit.test( ".data supports interoperable removal of hyphenated properties", function( assert ) { var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ), datas = { "non-empty": "a string", @@ -689,13 +687,12 @@ QUnit.test( ".data supports interoperable removal of hyphenated/camelCase proper "some-json": "{ \"foo\": \"bar\" }" }; - assert.expect( 27 ); + assert.expect( 18 ); jQuery.each( datas, function( key, val ) { div.data( key, val ); assert.deepEqual( div.data( key ), val, "get: " + key ); - assert.deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) ); div.removeData( key ); diff --git a/test/unit/deprecated.js b/test/unit/deprecated.js index f555ac655..6e44b3a45 100644 --- a/test/unit/deprecated.js +++ b/test/unit/deprecated.js @@ -183,3 +183,22 @@ QUnit.test( "jQuery.isWindow", function( assert ) { assert.ok( !jQuery.isWindow( /window/ ), "regexp" ); assert.ok( !jQuery.isWindow( function() {} ), "function" ); } ); + +QUnit.test( "jQuery.camelCase()", function( assert ) { + + var tests = { + "foo-bar": "fooBar", + "foo-bar-baz": "fooBarBaz", + "girl-u-want": "girlUWant", + "the-4th-dimension": "the-4thDimension", + "-o-tannenbaum": "OTannenbaum", + "-moz-illa": "MozIlla", + "-ms-take": "msTake" + }; + + assert.expect( 7 ); + + jQuery.each( tests, function( key, val ) { + assert.equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val ); + } ); +} ); |