Skip to content

Commit 9747559

Browse files
committed
operationScheme -> currentScheme
1 parent 99c610f commit 9747559

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/core/components/layouts/base.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default class BaseLayout extends React.Component {
7070
<Col className="schemes wrapper" mobile={12}>
7171
{ schemes && schemes.size ? (
7272
<Schemes
73-
operationScheme={specSelectors.operationScheme()}
73+
currentScheme={specSelectors.operationScheme()}
7474
schemes={ schemes }
7575
specActions={ specActions } />
7676
) : null }

src/core/components/operation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export default class Operation extends PureComponent {
229229
path={ path }
230230
method={ method }
231231
specActions={ specActions }
232-
operationScheme={ operationScheme } />
232+
currentScheme={ operationScheme } />
233233
</div> : null
234234
}
235235

src/core/components/schemes.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class Schemes extends React.Component {
66
static propTypes = {
77
specActions: PropTypes.object.isRequired,
88
schemes: PropTypes.object.isRequired,
9-
operationScheme: PropTypes.string.isRequired,
9+
currentScheme: PropTypes.string.isRequired,
1010
path: PropTypes.string,
1111
method: PropTypes.string,
1212
}
@@ -19,8 +19,8 @@ export default class Schemes extends React.Component {
1919
}
2020

2121
componentWillReceiveProps(nextProps) {
22-
if ( !this.props.operationScheme || !nextProps.schemes.includes(this.props.operationScheme) ) {
23-
// if we don't have a selected operationScheme or if our selected scheme is no longer an option,
22+
if ( !this.props.currentScheme || !nextProps.schemes.includes(this.props.currentScheme) ) {
23+
// if we don't have a selected currentScheme or if our selected scheme is no longer an option,
2424
// then fire 'change' event and select the first scheme in the list of options
2525
this.setScheme(nextProps.schemes.first())
2626
}

test/components/schemes.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { fromJS } from "immutable"
77
import Schemes from "components/schemes"
88

99
describe("<Schemes/>", function(){
10-
it("calls props.specActions.setScheme() when no operationScheme is selected", function(){
10+
it("calls props.specActions.setScheme() when no currentScheme is selected", function(){
1111

1212
let setSchemeSpy = createSpy()
1313

@@ -20,24 +20,24 @@ describe("<Schemes/>", function(){
2020
"http",
2121
"https"
2222
]),
23-
operationScheme: undefined,
23+
currentScheme: undefined,
2424
path: "/test",
2525
method: "get"
2626
}
2727

2828
// When
2929
let wrapper = shallow(<Schemes {...props}/>)
3030

31-
// Then operationScheme should default to first scheme in options list
31+
// Then currentScheme should default to first scheme in options list
3232
expect(props.specActions.setScheme).toHaveBeenCalledWith("http", "/test" , "get")
3333

34-
// When the operationScheme is no longer in the list of options
34+
// When the currentScheme is no longer in the list of options
3535
props.schemes = fromJS([
3636
"https"
3737
])
3838
wrapper.setProps(props)
3939

40-
// Then operationScheme should default to first scheme in options list
40+
// Then currentScheme should default to first scheme in options list
4141
expect(props.specActions.setScheme).toHaveBeenCalledWith("https", "/test", "get")
4242
})
4343

@@ -54,7 +54,7 @@ describe("<Schemes/>", function(){
5454
"http",
5555
"https"
5656
]),
57-
operationScheme: "https"
57+
currentScheme: "https"
5858
}
5959

6060
// When
@@ -66,7 +66,7 @@ describe("<Schemes/>", function(){
6666
// After an update
6767
wrapper.instance().componentWillReceiveProps(props)
6868

69-
// Should not be called again, since `operationScheme` is in schemes
69+
// Should not be called again, since `currentScheme` is in schemes
7070
expect(setSchemeSpy.calls.length).toEqual(1)
7171
})
7272
})

0 commit comments

Comments
 (0)