mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Add _#toString and _#valueOf.
Former-commit-id: adb194b6270fc72f794c69343891a2e891b90051
This commit is contained in:
@@ -694,7 +694,11 @@
|
||||
|
||||
equal(lodash.some([false, true, false]), true, '_.some: ' + basename);
|
||||
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
|
||||
equal(lodash(1).clone() instanceof lodash, false, '_(...) wrapped values are not chainable by default: ' + basename);
|
||||
|
||||
object = lodash(1);
|
||||
equal(object.clone() instanceof lodash, false, '_(...) wrapped values are not chainable by default: ' + basename);
|
||||
equal(String(object) === '1', false, '_.prototype should not implement its own `toString` method: ' + basename);
|
||||
equal(Number(object) === 1 , false, '_.prototype should not implement its own `valueOf` method: ' + basename);
|
||||
|
||||
start();
|
||||
});
|
||||
|
||||
22
test/test.js
22
test/test.js
@@ -1922,6 +1922,28 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).toString');
|
||||
|
||||
(function() {
|
||||
test('should return the `toString` result of the wrapped value', function() {
|
||||
var wrapped = _([1, 2, 3]);
|
||||
equal(String(wrapped), '1,2,3');
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).valueOf');
|
||||
|
||||
(function() {
|
||||
test('should return the `valueOf` result of the wrapped value', function() {
|
||||
var wrapped = _(123);
|
||||
equal(Number(wrapped), 123);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash methods');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user