Tests for components related to 'import from source' part #18

Merged
senaduka merged 7 commits from tests-for-import-from-source into master 2018-04-16 12:12:46 +02:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 4ac7284724 - Show all commits

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

@@ -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});
}
}