From 7e885a4ddd124976bf63f19088e85f2b03a98989 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 13 Apr 2016 08:20:58 -0700 Subject: [PATCH] Add `_.words` unit test for contractions. --- test/test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test.js b/test/test.js index f43ba5522..4739cec0a 100644 --- a/test/test.js +++ b/test/test.js @@ -24418,6 +24418,24 @@ assert.deepEqual(_.words('æiou2Consonants'), ['æiou', '2', 'Consonants']); }); + QUnit.test('should work with contractions', function(assert) { + assert.expect(2); + + var postfixes = ['d', 'll', 'm', 're', 's', 't', 've']; + + lodashStable.each(["'", '\u2019'], function(apos) { + var actual = lodashStable.map(postfixes, function(postfix) { + return _.words('a b' + apos + postfix + ' c'); + }); + + var expected = lodashStable.map(postfixes, function(postfix) { + return ['a', 'b' + apos + postfix, 'c']; + }); + + assert.deepEqual(actual, expected); + }); + }); + QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) { assert.expect(1);