fix: Allowing servers dropdown to change when oas3Actions.setSelectedServer is called (#6358)
ref: #6351
This commit is contained in:
@@ -109,7 +109,8 @@ export default class Servers extends React.Component {
|
||||
( server ) =>
|
||||
<option
|
||||
value={ server.get("url") }
|
||||
key={ server.get("url") }>
|
||||
key={ server.get("url") }
|
||||
selected={ currentServer === server.get("url") }>
|
||||
{ server.get("url") }
|
||||
{ server.get("description") && ` - ${server.get("description")}` }
|
||||
</option>
|
||||
|
||||
13
test/e2e-cypress/static/documents/bugs/6351.yaml
Normal file
13
test/e2e-cypress/static/documents/bugs/6351.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
title: OAS 3.0 sample with multiple servers
|
||||
version: 0.1.0
|
||||
servers:
|
||||
- url: http://testserver1.com
|
||||
- url: http://testserver2.com
|
||||
paths:
|
||||
/test/:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
13
test/e2e-cypress/tests/bugs/6351.js
Normal file
13
test/e2e-cypress/tests/bugs/6351.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/6351
|
||||
|
||||
describe("#6351: Server dropdown should change when switched via oas3Actions.setSelectedServer", () => {
|
||||
it("should show different selected server", () => {
|
||||
cy.visit("/?url=/documents/bugs/6351.yaml")
|
||||
.get("select")
|
||||
.contains("http://testserver1.com")
|
||||
.window()
|
||||
.then(win => win.ui.oas3Actions.setSelectedServer("http://testserver2.com"))
|
||||
.get("select")
|
||||
.contains("http://testserver2.com")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user