Skip to content

Commit

Permalink
Merge pull request #7009 from limzykenneth/textwrap-fes
Browse files Browse the repository at this point in the history
textWrap() parameter validation uses FES instead of throwing error
  • Loading branch information
limzykenneth committed May 4, 2024
2 parents 4d52230 + 6ad7e85 commit e6053b5
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 e6053b5

Please sign in to comment.