mirror of
https://github.com/ansible/awx.git
synced 2026-02-02 18:18:12 -03:30
update tests for org add/edit refactor
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -85,4 +85,5 @@ OrganizationEdit.contextTypes = {
|
||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
||||
};
|
||||
|
||||
export { OrganizationEdit as OrganizationEditNoRouter };
|
||||
export default withRouter(OrganizationEdit);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user