From 4b86df496635853741359fab8097db89e0eebcc6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 25 Oct 2015 02:09:19 -0700 Subject: [PATCH] Add `_.template` test for empty strings. --- test/test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test.js b/test/test.js index e5271e3aa..e632ce27b 100644 --- a/test/test.js +++ b/test/test.js @@ -18305,6 +18305,21 @@ 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) { assert.expect(1);