SOL-1225
This commit is contained in:
@@ -33,11 +33,6 @@ function(_, str, Backbone, BackboneRelational, gettext) {
|
||||
|
||||
validate: function(attrs) {
|
||||
var errors = null;
|
||||
if(_.has(attrs, 'name') && attrs.name.length > 40) {
|
||||
errors = _.extend({
|
||||
'name': gettext('Signatory name should not be more than 40 characters long.')
|
||||
}, errors);
|
||||
}
|
||||
if(_.has(attrs, 'title')){
|
||||
var title = attrs.title;
|
||||
var lines = title.split(/\r\n|\r|\n/);
|
||||
@@ -46,13 +41,6 @@ function(_, str, Backbone, BackboneRelational, gettext) {
|
||||
'title': gettext('Signatory title should span over maximum of 2 lines.')
|
||||
}, errors);
|
||||
}
|
||||
else if ((lines.length > 1 && (lines[0].length > 53 && lines[1].length > 53)) ||
|
||||
(lines.length === 1 && title.length > 106)) {
|
||||
errors = _.extend({
|
||||
'title': gettext('Signatory title should have maximum of 40 characters per line.')
|
||||
}, errors);
|
||||
}
|
||||
|
||||
}
|
||||
if (errors !== null){
|
||||
return errors;
|
||||
|
||||
@@ -252,7 +252,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
inputSignatoryTitle: 'This is a certificate signatory title that has waaaaaaay more than 106 characters, in order to cause an exception.'
|
||||
inputSignatoryTitle: 'Signatory Title \non three \nlines'
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
|
||||
@@ -228,10 +228,10 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
|
||||
}
|
||||
);
|
||||
|
||||
it('signatories should not save when fields have too many characters per line', function() {
|
||||
it('signatories should save when fields have too many characters per line', function() {
|
||||
this.view.$(SELECTORS.addSignatoryButton).click();
|
||||
setValuesToInputs(this.view, {
|
||||
inputCertificateName: 'New Certificate Name'
|
||||
inputCertificateName: 'New Certificate Name that has too many characters without any limit'
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
@@ -243,7 +243,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
|
||||
});
|
||||
|
||||
this.view.$(SELECTORS.saveCertificateButton).click();
|
||||
expect(this.view.$('.certificate-edit-error')).toHaveClass('is-shown');
|
||||
expect(this.view.$('.certificate-edit-error')).not.toHaveClass('is-shown');
|
||||
});
|
||||
|
||||
it('signatories should not save when title span on more than 2 lines', function() {
|
||||
|
||||
Reference in New Issue
Block a user