mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Add split and replace to LodashWrapper. [closes #1016]
This commit is contained in:
53
test/test.js
53
test/test.js
@@ -15653,6 +15653,25 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).replace');
|
||||
|
||||
(function() {
|
||||
test('should support string replace', 2, function() {
|
||||
if (!isNpm) {
|
||||
var string = 'hi hidash',
|
||||
wrapped = _(string);
|
||||
|
||||
deepEqual(wrapped.replace('hi', 'lo').value(), 'lo hidash');
|
||||
deepEqual(wrapped.replace(/hi/g, 'lo').value(), 'lo lodash');
|
||||
}
|
||||
else {
|
||||
skipTest(2);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).reverse');
|
||||
|
||||
(function() {
|
||||
@@ -15822,6 +15841,40 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).split');
|
||||
|
||||
(function() {
|
||||
test('should support string split', 1, function() {
|
||||
if (!isNpm) {
|
||||
var string = 'hi ya',
|
||||
wrapped = _(string),
|
||||
actual = ['hi', 'ya'];
|
||||
|
||||
deepEqual(wrapped.split(' ').value(), actual);
|
||||
}
|
||||
else {
|
||||
skipTest(1);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
(function() {
|
||||
test('should allow mixed string and array prototype methods', 1, function() {
|
||||
if (!isNpm) {
|
||||
var string = 'hi ya',
|
||||
wrapped = _(string),
|
||||
actual = 'hi,ya';
|
||||
|
||||
deepEqual(wrapped.split(' ').join(','), actual);
|
||||
}
|
||||
else {
|
||||
skipTest(1);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...).unshift');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user