diff --git a/src/core/components/layouts/base.jsx b/src/core/components/layouts/base.jsx index ea5fbce1..268ef46c 100644 --- a/src/core/components/layouts/base.jsx +++ b/src/core/components/layouts/base.jsx @@ -70,7 +70,7 @@ export default class BaseLayout extends React.Component { { schemes && schemes.size ? ( ) : null } diff --git a/src/core/components/operation.jsx b/src/core/components/operation.jsx index fc182a1e..4f6534db 100644 --- a/src/core/components/operation.jsx +++ b/src/core/components/operation.jsx @@ -229,7 +229,7 @@ export default class Operation extends PureComponent { path={ path } method={ method } specActions={ specActions } - operationScheme={ operationScheme } /> + currentScheme={ operationScheme } /> : null } diff --git a/src/core/components/schemes.jsx b/src/core/components/schemes.jsx index a3a27ad1..ed0947fe 100644 --- a/src/core/components/schemes.jsx +++ b/src/core/components/schemes.jsx @@ -6,7 +6,7 @@ export default class Schemes extends React.Component { static propTypes = { specActions: PropTypes.object.isRequired, schemes: PropTypes.object.isRequired, - operationScheme: PropTypes.string.isRequired, + currentScheme: PropTypes.string.isRequired, path: PropTypes.string, method: PropTypes.string, } @@ -19,8 +19,8 @@ export default class Schemes extends React.Component { } componentWillReceiveProps(nextProps) { - if ( !this.props.operationScheme || !nextProps.schemes.includes(this.props.operationScheme) ) { - // if we don't have a selected operationScheme or if our selected scheme is no longer an option, + if ( !this.props.currentScheme || !nextProps.schemes.includes(this.props.currentScheme) ) { + // if we don't have a selected currentScheme 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()) } diff --git a/test/components/schemes.js b/test/components/schemes.js index 8e0ebc1f..9cea4a4e 100644 --- a/test/components/schemes.js +++ b/test/components/schemes.js @@ -7,7 +7,7 @@ import { fromJS } from "immutable" import Schemes from "components/schemes" describe("", function(){ - it("calls props.specActions.setScheme() when no operationScheme is selected", function(){ + it("calls props.specActions.setScheme() when no currentScheme is selected", function(){ let setSchemeSpy = createSpy() @@ -20,7 +20,7 @@ describe("", function(){ "http", "https" ]), - operationScheme: undefined, + currentScheme: undefined, path: "/test", method: "get" } @@ -28,16 +28,16 @@ describe("", function(){ // When let wrapper = shallow() - // Then operationScheme should default to first scheme in options list + // Then currentScheme should default to first scheme in options list expect(props.specActions.setScheme).toHaveBeenCalledWith("http", "/test" , "get") - // When the operationScheme is no longer in the list of options + // When the currentScheme is no longer in the list of options props.schemes = fromJS([ "https" ]) wrapper.setProps(props) - // Then operationScheme should default to first scheme in options list + // Then currentScheme should default to first scheme in options list expect(props.specActions.setScheme).toHaveBeenCalledWith("https", "/test", "get") }) @@ -54,7 +54,7 @@ describe("", function(){ "http", "https" ]), - operationScheme: "https" + currentScheme: "https" } // When @@ -66,7 +66,7 @@ describe("", function(){ // After an update wrapper.instance().componentWillReceiveProps(props) - // Should not be called again, since `operationScheme` is in schemes + // Should not be called again, since `currentScheme` is in schemes expect(setSchemeSpy.calls.length).toEqual(1) }) })