Fixes #3405 - Changed logic for schemes.jsx component to select default scheme when there is no selected scheme. Added test for functionality.

This commit is contained in:
Owen Conti
2017-07-18 19:58:02 -06:00
parent aab1403ba5
commit 2c35ba2c8f
2 changed files with 44 additions and 2 deletions

View File

@@ -19,8 +19,9 @@ export default class Schemes extends React.Component {
}
componentWillReceiveProps(nextProps) {
if ( this.props.operationScheme && !nextProps.schemes.has(this.props.operationScheme) ) {
//fire 'change' event if our selected scheme is no longer an option
if ( !this.props.operationScheme || !nextProps.schemes.has(this.props.operationScheme) ) {
// if we don't have a selected operationScheme or if our selected scheme is no longer an option,
// then fire 'change' event and select the first scheme in the list of options
this.setScheme(nextProps.schemes.first())
}
}