Skip to content

Commit 6ad418d

Browse files
fix: Updating select to pass in a better prop; updating test to do a better check (#6385)
fixes #6372
1 parent 26a0fd8 commit 6ad418d

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/core/plugins/oas3/components/servers.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ export default class Servers extends React.Component {
104104
return (
105105
<div className="servers">
106106
<label htmlFor="servers">
107-
<select onChange={ this.onServerChange }>
107+
<select onChange={ this.onServerChange } value={currentServer}>
108108
{ servers.valueSeq().map(
109109
( server ) =>
110110
<option
111111
value={ server.get("url") }
112-
key={ server.get("url") }
113-
selected={ currentServer === server.get("url") }>
112+
key={ server.get("url") }>
114113
{ server.get("url") }
115114
{ server.get("description") && ` - ${server.get("description")}` }
116115
</option>

test/e2e-cypress/tests/bugs/6351.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
describe("#6351: Server dropdown should change when switched via oas3Actions.setSelectedServer", () => {
44
it("should show different selected server", () => {
55
cy.visit("/?url=/documents/bugs/6351.yaml")
6-
.get("select")
7-
.contains("http://testserver1.com")
6+
.get("select").should("have.value", "http://testserver1.com")
87
.window()
98
.then(win => win.ui.oas3Actions.setSelectedServer("http://testserver2.com"))
10-
.get("select")
11-
.contains("http://testserver2.com")
9+
.get("select").should("have.value", "http://testserver2.com")
1210
})
1311
})

0 commit comments

Comments
 (0)