Merge branch 'tests-for-import-from-source' into summarizer-feature

This commit is contained in:
GotPPay
2018-04-11 10:54:34 +02:00
3 changed files with 16 additions and 8 deletions

View File

@@ -40,7 +40,8 @@ class Contact extends Component {
}
handleEmailEdit(e){
if (e.length === EMAIL_MAX_LENGTH) return;
const isEmailInvalid = e.length >= EMAIL_MAX_LENGTH;
if (isEmailInvalid) return;
this.setState({contactEmail: e});
}
}

View File

@@ -155,14 +155,16 @@ class IntentDetails extends Component {
}
handleQuestionEdit (e, index) {
if (e.length >= QUESTION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e)) return;
const isQuestionInvalid = e.length >= QUESTION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isQuestionInvalid) return;
let newIntent = this.state.intent;
newIntent.questions[index] = e;
this.setState ({intent: newIntent});
}
handleIntentExplanationEdit (e, index) {
if (e.length >= INTENT_EXPLANATION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e))
const isExplanationInvalid = e.length >= INTENT_EXPLANATION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isExplanationInvalid)
return;
let newIntent = this.state.intent;
newIntent.intentExplanation = e;
@@ -170,21 +172,24 @@ class IntentDetails extends Component {
}
handleAnswerEdit (e) {
if (e.length >= ANSWER_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e)) return;
const isAnswerInvalid = e.length >= ANSWER_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
if (isAnswerInvalid) return;
let newIntent = this.state.intent;
newIntent.answer = e;
this.setState ({intent: newIntent});
}
handleAnswerSourceEdit (e) {
if (e.length >= ANSWER_MAX_LENGTH) return;
const isAnswerSourceInvalid = e.length >= ANSWER_MAX_LENGTH;
if (isAnswerSourceInvalid) return;
let newIntent = this.state.intent;
newIntent.externalAnswerSource = e;
this.setState ({intent: newIntent});
}
handleIntentNameEdit (e) {
if (e.length >= INTENT_NAME_MAX_LENGTH || !/^[a-z]*$/i.test (e)) return;
const isIntentNameInvalid = e.length >= INTENT_NAME_MAX_LENGTH || !/^[a-z]*$/i.test (e);
if (isIntentNameInvalid) return;
let newIntent = this.state.intent;
newIntent.intentName = e;
this.setState ({intent: newIntent});

View File

@@ -52,12 +52,14 @@ class LaunchRequest extends Component {
}
handleNameEdit(e){
if (e.length === INVOCATION_NAME_MAX_LENGTH || !(/^[a-z,.' ]*$/.test(e))) return;
const isInvocationNameInvalid = e.length === INVOCATION_NAME_MAX_LENGTH || !(/^[a-z,.' ]*$/.test(e));
if (isInvocationNameInvalid) return;
this.setState({invocationName: e});
}
handleAnswerEdit(e){
if (e.length === INVOCATION_ANSWER_MAX_LENGTH || !(/^[a-z,.' ]*$/i.test(e))) return;
const isInvocationAnswerInvalid = e.length === INVOCATION_ANSWER_MAX_LENGTH || !(/^[a-z,.' ]*$/i.test(e));
if (isInvocationAnswerInvalid) return;
this.setState({invocationAnswer: e});
}
}