diff options
author | John Hoven <hovenj@gmail.com> | 2014-03-06 13:56:09 -0600 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2014-03-20 15:44:09 -0400 |
commit | 9ec429cf6270e455aba4eba85f4db80e633806b6 (patch) | |
tree | d3d8da0da9072551906104d9f572273ccdee6b31 /test/unit | |
parent | 5a1db91bf3e58a55bfa2baa9a3d27de3b6244ede (diff) | |
download | jquery-9ec429cf6270e455aba4eba85f4db80e633806b6.tar.gz jquery-9ec429cf6270e455aba4eba85f4db80e633806b6.zip |
Attributes: Trim whitespace from option text when returned as a value
Fixes #14858
Ref #14686
Closes gh-1531
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/attributes.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 32fd7b958..2ab583caa 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1462,3 +1462,16 @@ test( "should not throw at $(option).val() (#14686)", 1, function() { ok( false ); } }); + +test( "Insignificant white space returned for $(option).val() (#14858)", function() { + expect ( 3 ); + + var val = jQuery( "<option></option>" ).val(); + equal( val.length, 0, "Empty option should have no value" ); + + val = jQuery( "<option> </option>" ).val(); + equal( val.length, 0, "insignificant white-space returned for value" ); + + val = jQuery( "<option> test </option>" ).val(); + equal( val.length, 4, "insignificant white-space returned for value" ); +}); |