update tests for org add/edit refactor

This commit is contained in:
Keith Grant
2019-03-28 13:02:04 -04:00
parent 64e933acb4
commit 6353d5e410
8 changed files with 424 additions and 334 deletions

View File

@@ -65,7 +65,7 @@ class OrganizationForm extends Component {
this.setState({ instanceGroups });
}
async handleSubmit (values) {
handleSubmit (values) {
const { handleSubmit } = this.props;
const { instanceGroups, initialInstanceGroups } = this.state;

View File

@@ -85,4 +85,5 @@ OrganizationEdit.contextTypes = {
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
};
export { OrganizationEdit as OrganizationEditNoRouter };
export default withRouter(OrganizationEdit);

View File

@@ -19,8 +19,6 @@ class OrganizationAdd extends React.Component {
constructor (props) {
super(props);
this.handleFieldChange = this.handleFieldChange.bind(this);
this.handleInstanceGroupsChange = this.handleInstanceGroupsChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleCancel = this.handleCancel.bind(this);
this.handleSuccess = this.handleSuccess.bind(this);
@@ -30,14 +28,6 @@ class OrganizationAdd extends React.Component {
};
}
handleFieldChange (val, evt) {
this.setState({ [evt.target.name]: val || evt.target.value });
}
handleInstanceGroupsChange (val, targetName) {
this.setState({ [targetName]: val });
}
async handleSubmit (values, groupsToAssociate) {
const { api } = this.props;
try {
@@ -114,4 +104,5 @@ OrganizationAdd.contextTypes = {
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
};
export { OrganizationAdd as OrganizationAddNoRouter };
export default withRouter(OrganizationAdd);

View File

@@ -11,7 +11,8 @@ export function required (message) {
export function maxLength (max) {
return value => {
if (value.trim() > max) {
if (value.trim().length
> max) {
return i18nMark(`This field must not exceed ${max} characters`);
}
return undefined;