This repository has been archived by the owner on May 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display error when service instance creation fails
- Loading branch information
1 parent
b8a6405
commit b53d3b5
Showing
11 changed files
with
165 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import style from 'cloudgov-style/css/cloudgov-style.css'; | ||
|
||
import createStyler from '../../util/create_styler'; | ||
|
||
const propTypes = { message: PropTypes.string }; | ||
const defaultProps = { message: '' }; | ||
|
||
export default class FormError extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.styler = createStyler(style); | ||
} | ||
|
||
render() { | ||
return ( | ||
<span className={ this.styler('error_message')}> | ||
{ this.props.message } | ||
</span> | ||
); | ||
} | ||
} | ||
const FormError = ({ message }) => | ||
<span className="error_message"> | ||
{ message } | ||
</span>; | ||
|
||
FormError.propTypes = propTypes; | ||
FormError.defaultProps = defaultProps; | ||
|
||
export default FormError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
static_src/test/unit/components/create_service_instance.spec.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import '../../global_setup'; | ||
|
||
import React from 'react'; | ||
import CreateServiceInstance from '../../../components/create_service_instance.jsx'; | ||
import FormError from '../../../components/form/form_error.jsx'; | ||
import Immutable from 'immutable'; | ||
import SpaceStore from '../../../stores/space_store'; | ||
import ServiceInstanceStore from '../../../stores/service_instance_store'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('<CreateServiceInstance />', () => { | ||
beforeEach(() => { | ||
ServiceInstanceStore._createError = { description: 'Bad stuff everyone' }; | ||
}); | ||
|
||
it('displays an error message when ServiceInstanceStore has one', () => { | ||
SpaceStore._data = Immutable.fromJS([]); | ||
|
||
const wrapper = shallow(<CreateServiceInstance servicePlan={ {} } />); | ||
|
||
expect(wrapper.find(FormError).length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.