mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Add _.template test for empty strings.
This commit is contained in:
15
test/test.js
15
test/test.js
@@ -18305,6 +18305,21 @@
|
|||||||
assert.strictEqual(compiled(data), '');
|
assert.strictEqual(compiled(data), '');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should return an empty string for empty values', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var data = data = { 'a': 1 },
|
||||||
|
values = [, null, undefined, ''],
|
||||||
|
expected = lodashStable.map(values, lodashStable.constant(''));
|
||||||
|
|
||||||
|
var actual = lodashStable.map(values, function(value, index) {
|
||||||
|
var compiled = index ? _.template(value) : _.template();
|
||||||
|
return compiled(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should parse delimiters without newlines', function(assert) {
|
QUnit.test('should parse delimiters without newlines', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user