Skip to content

Commit 4542806

Browse files
authored
bug: remove clearValidation from onTryoutClick (#5955)
1 parent 5eb23cd commit 4542806

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

src/core/components/execute.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export default class Execute extends Component {
2222
this.props.onExecute()
2323
}
2424
specActions.execute( { operation, path, method } )
25+
} else {
26+
// deferred by 40ms, to give element class change time to settle.
27+
specActions.clearValidateParams( [path, method] )
28+
setTimeout(() => {
29+
specActions.validateParams([path, method])
30+
}, 40)
2531
}
2632
}
2733

src/core/containers/OperationContainer.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ export default class OperationContainer extends PureComponent {
118118
}
119119

120120
onTryoutClick =() => {
121-
let { specActions, path, method } = this.props
122121
this.setState({tryItOutEnabled: !this.state.tryItOutEnabled})
123-
specActions.clearValidateParams([path, method])
124122
}
125123

126124
onExecute = () => {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
describe("#5070: Required field not highlighted on click of Execute button (second time)", () => {
2+
it("should not clear error class=invalid on input field (Swagger)", () => {
3+
cy
4+
.visit("/?url=/documents/petstore.swagger.yaml")
5+
.get("#operations-pet-getPetById")
6+
.click()
7+
// Expand Try It Out
8+
.get(".try-out__btn")
9+
.click()
10+
// Execute without user input
11+
.get(".execute.opblock-control__btn")
12+
.click()
13+
.get(".parameters-col_description input")
14+
.should($el => {
15+
expect($el).to.have.length(1)
16+
const className = $el[0].className
17+
expect(className).to.match(/invalid/i)
18+
})
19+
// Cancel Try It Out
20+
.get(".cancel")
21+
.click()
22+
// Expand Try It Out (Again)
23+
.get(".try-out__btn")
24+
.click()
25+
.get(".parameters-col_description input")
26+
.should($el => {
27+
expect($el).to.have.length(1)
28+
const className = $el[0].className
29+
expect(className).to.match(/invalid/i)
30+
})
31+
})
32+
})

0 commit comments

Comments
 (0)