diff --git a/src/typography/attributes.js b/src/typography/attributes.js index f5242f415b..3960ad53bc 100644 --- a/src/typography/attributes.js +++ b/src/typography/attributes.js @@ -539,9 +539,8 @@ p5.prototype._updateTextMetrics = function() { * */ p5.prototype.textWrap = function(wrapStyle) { - if (wrapStyle !== 'WORD' && wrapStyle !== 'CHAR') { - throw 'Error: textWrap accepts only WORD or CHAR'; - } + p5._validateParameters('textWrap', [wrapStyle]); + return this._renderer.textWrap(wrapStyle); }; diff --git a/test/unit/typography/attributes.js b/test/unit/typography/attributes.js index cb234f2a5b..ebfa6b552f 100644 --- a/test/unit/typography/attributes.js +++ b/test/unit/typography/attributes.js @@ -113,11 +113,6 @@ suite('Typography Attributes', function() { }); suite('p5.prototype.textWrap', function() { - test('should throw error for non-constant input', function() { - expect(function() { - myp5.textWrap('NO-WRAP'); - }).to.throw('Error: textWrap accepts only WORD or CHAR'); - }); test('returns textWrap text attribute', function() { assert.strictEqual(myp5.textWrap(myp5.WORD), myp5.WORD); });