aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2016-03-17 13:03:39 -0400
committerTimmy Willison <timmywillisn@gmail.com>2016-03-17 13:03:39 -0400
commit92fb9de22cbd35917da108acf71ecb5bb8bd7338 (patch)
tree45dff4a13dc224ebb5aebad388a3ef3f2f6310d7
parentda015d9ca07bfd07bfcb44cddb7defd04169d627 (diff)
downloadjquery-92fb9de22cbd35917da108acf71ecb5bb8bd7338.tar.gz
jquery-92fb9de22cbd35917da108acf71ecb5bb8bd7338.zip
Attributes: ignore option value mismatch on untrimmed unicode whitespace
-rw-r--r--test/unit/attributes.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 2fe5fe00a..def62cb4a 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -1120,7 +1120,8 @@ QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {
"\\u00a0": "\u00a0",
"\\u1680": "\u1680"
},
- html = "";
+ html = "",
+ runicode = /^\\u/;
jQuery.each( spaces, function( key, obj ) {
var value = obj.html || obj;
html += "<option value='attr" + value + "'></option>";
@@ -1151,9 +1152,15 @@ QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {
$select.html( html );
$select.val( "text" );
- assert.equal( $select.val(), "text", "Value with space character at beginning or end is stripped (" + key + ") selected (text)" );
- if ( /^\\u/.test( key ) ) {
+ // IE6-8 doesn't trim the option values
+ if ( runicode.test( key ) && /msie [678]\.0/i.test( window.navigator.userAgent ) ) {
+ assert.ok( true, "IE6-8 doesn't trim the option values" );
+ } else {
+ assert.equal( $select.val(), "text", "Value with space character at beginning or end is stripped (" + key + ") selected (text)" );
+ }
+
+ if ( runicode.test( key ) ) {
$select.val( "te" + val + "xt" );
assert.equal( $select.val(), "te" + val + "xt", "Value with non-space whitespace character (" + key + ") in the middle selected (text)" );
} else {