Skip to content

Commit

Permalink
textWrap() parameter validation uses FES instead of throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed May 4, 2024
1 parent 7cb4f9e commit 6ad7e85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/typography/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,8 @@ p5.prototype._updateTextMetrics = function() {
* </div>
*/
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);
};

Expand Down
5 changes: 0 additions & 5 deletions test/unit/typography/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 6ad7e85

Please sign in to comment.