diff options
author | Shashanka Nataraj <ShashankaNataraj@users.noreply.github.com> | 2019-08-22 05:36:26 +0530 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-26 01:00:55 +0200 |
commit | 56e73e0c4ae908c853c986aadeda7cfcf2df4f6f (patch) | |
tree | 6f6aaa33b8fa94c0cfdc827431a64d7d569ec7d7 /test | |
parent | 2f666c1daba43d26d77d9500db09d528bf66fac8 (diff) | |
download | jquery-56e73e0c4ae908c853c986aadeda7cfcf2df4f6f.tar.gz jquery-56e73e0c4ae908c853c986aadeda7cfcf2df4f6f.zip |
Core: Deprecate jQuery.trim
Fixes gh-4363
Closes gh-4461
(cherry picked from 5ea5946094784f68437ef26d463dfcfbbbaff1f6)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/basic.js | 3 | ||||
-rw-r--r-- | test/unit/core.js | 22 | ||||
-rw-r--r-- | test/unit/deprecated.js | 22 |
3 files changed, 23 insertions, 24 deletions
diff --git a/test/unit/basic.js b/test/unit/basic.js index bed27dcba..c42ee5450 100644 --- a/test/unit/basic.js +++ b/test/unit/basic.js @@ -76,12 +76,11 @@ QUnit.test( "show/hide", function( assert ) { } QUnit.test( "core", function( assert ) { - assert.expect( 18 ); + assert.expect( 17 ); var elem = jQuery( "<div></div><span></span>" ); assert.strictEqual( elem.length, 2, "Correct number of elements" ); - assert.strictEqual( jQuery.trim( " hello " ), "hello", "jQuery.trim" ); assert.ok( jQuery.isPlainObject( { "a": 2 } ), "jQuery.isPlainObject(object)" ); assert.ok( !jQuery.isPlainObject( "foo" ), "jQuery.isPlainObject(String)" ); diff --git a/test/unit/core.js b/test/unit/core.js index c3deef1f7..05ea4337e 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -216,28 +216,6 @@ QUnit.test( "noConflict", function( assert ) { window[ "jQuery" ] = jQuery = $$; } ); -QUnit.test( "trim", function( assert ) { - assert.expect( 13 ); - - var nbsp = String.fromCharCode( 160 ); - - assert.equal( jQuery.trim( "hello " ), "hello", "trailing space" ); - assert.equal( jQuery.trim( " hello" ), "hello", "leading space" ); - assert.equal( jQuery.trim( " hello " ), "hello", "space on both sides" ); - assert.equal( jQuery.trim( " " + nbsp + "hello " + nbsp + " " ), "hello", " " ); - - assert.equal( jQuery.trim(), "", "Nothing in." ); - assert.equal( jQuery.trim( undefined ), "", "Undefined" ); - assert.equal( jQuery.trim( null ), "", "Null" ); - assert.equal( jQuery.trim( 5 ), "5", "Number" ); - assert.equal( jQuery.trim( false ), "false", "Boolean" ); - - assert.equal( jQuery.trim( " " ), "", "space should be trimmed" ); - assert.equal( jQuery.trim( "ipad\xA0" ), "ipad", "nbsp should be trimmed" ); - assert.equal( jQuery.trim( "\uFEFF" ), "", "zwsp should be trimmed" ); - assert.equal( jQuery.trim( "\uFEFF \xA0! | \uFEFF" ), "! |", "leading/trailing should be trimmed" ); -} ); - QUnit.test( "isPlainObject", function( assert ) { var done = assert.async(); diff --git a/test/unit/deprecated.js b/test/unit/deprecated.js index d8b5a5181..977ab35eb 100644 --- a/test/unit/deprecated.js +++ b/test/unit/deprecated.js @@ -600,3 +600,25 @@ QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isNumeric(Symbol)", fu assert.equal( jQuery.isNumeric( Symbol() ), false, "Symbol" ); assert.equal( jQuery.isNumeric( Object( Symbol() ) ), false, "Symbol inside an object" ); } ); + +QUnit.test( "trim", function( assert ) { + assert.expect( 13 ); + + var nbsp = String.fromCharCode( 160 ); + + assert.equal( jQuery.trim( "hello " ), "hello", "trailing space" ); + assert.equal( jQuery.trim( " hello" ), "hello", "leading space" ); + assert.equal( jQuery.trim( " hello " ), "hello", "space on both sides" ); + assert.equal( jQuery.trim( " " + nbsp + "hello " + nbsp + " " ), "hello", " " ); + + assert.equal( jQuery.trim(), "", "Nothing in." ); + assert.equal( jQuery.trim( undefined ), "", "Undefined" ); + assert.equal( jQuery.trim( null ), "", "Null" ); + assert.equal( jQuery.trim( 5 ), "5", "Number" ); + assert.equal( jQuery.trim( false ), "false", "Boolean" ); + + assert.equal( jQuery.trim( " " ), "", "space should be trimmed" ); + assert.equal( jQuery.trim( "ipad\xA0" ), "ipad", "nbsp should be trimmed" ); + assert.equal( jQuery.trim( "\uFEFF" ), "", "zwsp should be trimmed" ); + assert.equal( jQuery.trim( "\uFEFF \xA0! | \uFEFF" ), "! |", "leading/trailing should be trimmed" ); +} ); |