fix: add autofocus to auth fields (#6483)
This commit is contained in:
@@ -70,7 +70,7 @@ export default class ApiKeyAuth extends React.Component {
|
||||
<label>Value:</label>
|
||||
{
|
||||
value ? <code> ****** </code>
|
||||
: <Col><Input type="text" onChange={ this.onChange }/></Col>
|
||||
: <Col><Input type="text" onChange={ this.onChange } autoFocus/></Col>
|
||||
}
|
||||
</Row>
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ export default class BasicAuth extends React.Component {
|
||||
<label>Username:</label>
|
||||
{
|
||||
username ? <code> { username } </code>
|
||||
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange }/></Col>
|
||||
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange } autoFocus/></Col>
|
||||
}
|
||||
</Row>
|
||||
<Row>
|
||||
|
||||
@@ -148,7 +148,7 @@ export default class Oauth2 extends React.Component {
|
||||
{
|
||||
isAuthorized ? <code> { this.state.username } </code>
|
||||
: <Col tablet={10} desktop={10}>
|
||||
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange }/>
|
||||
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange } autoFocus/>
|
||||
</Col>
|
||||
}
|
||||
</Row>
|
||||
|
||||
@@ -7,6 +7,17 @@ describe("OAuth2 Application flow", function() {
|
||||
}).as("tokenRequest")
|
||||
})
|
||||
|
||||
// https://github.com/swagger-api/swagger-ui/issues/6395
|
||||
it("should have first authorization input autofocused", () => {
|
||||
cy
|
||||
.visit("/?url=http://localhost:3231/swagger.yaml")
|
||||
.get(".btn.authorize")
|
||||
.click()
|
||||
|
||||
cy.focused()
|
||||
.should("have.id", "oauth_username")
|
||||
})
|
||||
|
||||
it("should make an application flow Authorization header request", () => {
|
||||
cy
|
||||
.visit("/?url=http://localhost:3231/swagger.yaml")
|
||||
@@ -52,4 +63,4 @@ describe("OAuth2 Application flow", function() {
|
||||
.get(".live-responses-table .response-col_status")
|
||||
.contains("200")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user