mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
Add whitespace tests.
This commit is contained in:
@@ -203,7 +203,7 @@
|
||||
var shadowedObject = _.invert(shadowedProps);
|
||||
|
||||
/** Used to check for problems removing whitespace */
|
||||
var whitespace = ' \t\x0B\f\xA0\ufeff\n\r\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
|
||||
var whitespace = ' \t\x0B\f\x85\xA0\ufeff\n\r\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
|
||||
|
||||
/**
|
||||
* Removes all own enumerable properties from a given object.
|
||||
@@ -9359,6 +9359,13 @@
|
||||
strictEqual(func(string), (index == 2 ? whitespace : '') + 'a b c' + (index == 1 ? whitespace : ''));
|
||||
});
|
||||
|
||||
test('`_.' + methodName + '` should not remove non-whitespace characters', 1, function() {
|
||||
var problemChars = '\u200b\ufffe',
|
||||
string = problemChars + 'a b c' + problemChars;
|
||||
|
||||
strictEqual(func(string), string);
|
||||
});
|
||||
|
||||
test('`_.' + methodName + '` should coerce `string` to a string', 1, function() {
|
||||
var object = { 'toString': function() { return whitespace + 'a b c' + whitespace; } };
|
||||
strictEqual(func(object), (index == 2 ? whitespace : '') + 'a b c' + (index == 1 ? whitespace : ''));
|
||||
|
||||
Reference in New Issue
Block a user