mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
🎨 Increased maximum tag description length to 500 (#904)
no issue - Increased the possible length of the tag description field from 200 to 500
This commit is contained in:
parent
6ee8da83cb
commit
0d4f7fa726
4 changed files with 7 additions and 7 deletions
|
@ -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">
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(() => {
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue