Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🎨 Increased maximum tag description length to 500 (#904)
Browse files Browse the repository at this point in the history
no issue

- Increased the possible length of the tag description field from 200 to 500
  • Loading branch information
aileen authored and kevinansfield committed Nov 7, 2017
1 parent 6ee8da8 commit 0d4f7fa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/templates/components/gh-tag-settings-form.hbs
Expand Up @@ -33,7 +33,7 @@
<label for="tag-description">Description</label>
{{gh-textarea scratchDescription id="tag-description" name="description" focusOut=(action 'setProperty' 'description' scratchDescription) update=(action (mut scratchDescription))}}
{{gh-error-message errors=tag.errors property="description"}}
<p>Maximum: <b>200</b> characters. You’ve used {{gh-count-down-characters scratchDescription 200}}</p>
<p>Maximum: <b>500</b> characters. You’ve used {{gh-count-down-characters scratchDescription 500}}</p>
{{/gh-form-group}}

<ul class="nav-list nav-list-block">
Expand Down
4 changes: 2 additions & 2 deletions app/validators/tag-settings.js
Expand Up @@ -30,8 +30,8 @@ export default BaseValidator.create({
description(model) {
let description = model.get('description');

if (!validator.isLength(description, 0, 200)) {
model.get('errors').add('description', 'Description cannot be longer than 200 characters.');
if (!validator.isLength(description, 0, 500)) {
model.get('errors').add('description', 'Description cannot be longer than 500 characters.');
this.invalidate();
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/gh-tag-settings-form-test.js
Expand Up @@ -273,7 +273,7 @@ describe('Integration: Component: gh-tag-settings-form', function () {
expect(this.$('.seo-preview-description').text(), 'falls back to tag description without metaDescription').to.equal('Description.');

run(() => {
this.set('tag.description', (new Array(200).join('x')));
this.set('tag.description', (new Array(500).join('x')));
});
let expectedLength = 156 + '…'.length;
expect(this.$('.seo-preview-description').text().length, 'cuts description to max 156 chars').to.equal(expectedLength);
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/validators/tag-settings-test.js
Expand Up @@ -194,11 +194,11 @@ describe('Unit: Validator: tag-settings', function () {

it('validates description length', function () {
// shortest invalid description
let tag = Tag.create({description: (new Array(202).join('x'))});
let tag = Tag.create({description: (new Array(502).join('x'))});
let passed = false;
let errors;

expect(tag.get('description').length, 'description length').to.equal(201);
expect(tag.get('description').length, 'description length').to.equal(501);

run(() => {
tag.validate({property: 'description'}).then(() => {
Expand All @@ -208,7 +208,7 @@ describe('Unit: Validator: tag-settings', function () {

errors = tag.get('errors').errorsFor('description')[0];
expect(errors.attribute, 'errors.description.attribute').to.equal('description');
expect(errors.message, 'errors.description.message').to.equal('Description cannot be longer than 200 characters.');
expect(errors.message, 'errors.description.message').to.equal('Description cannot be longer than 500 characters.');

// TODO: tag.errors appears to be a singleton and previous errors are
// not cleared despite creating a new tag object
Expand Down

0 comments on commit 0d4f7fa

Please sign in to comment.