Files
swagger-ui/test/e2e-cypress/tests/features/model-collapse.js
Giles Wells 72811bd827 feat: Accessibility improvements (#7224)
* feat: adds a11y for ContentType & Responses region

* feat: adds a11y to expandable/collapsible elements

* fix: add aria label to select element for content types

* fix: add aria label prop to contentType component

* Change optag to h3 for better tag hierarchy


Co-authored-by: ediiotero <eddie.otero@oddball.io>
Co-authored-by: Mike Lumetta <mike.lumetta@adhocteam.us>
Co-authored-by: Alexander Valencia <alex.valencia@adhocteam.us>
2021-05-12 09:40:31 -07:00

50 lines
1.5 KiB
JavaScript

describe("Model collapse/expand feature", () => {
describe("in Swagger 2", () => {
const swagger2BaseUrl = "/?deepLinking=true&url=/documents/features/models.swagger.yaml"
const urlFragment = "#/definitions/Pet"
ModelCollapseTest(swagger2BaseUrl, urlFragment)
})
describe("in OpenAPI 3", () => {
const openAPI3BaseUrl = "/?deepLinking=true&url=/documents/features/models.openapi.yaml"
ModelCollapseTest(openAPI3BaseUrl)
})
})
function ModelCollapseTest(baseUrl, urlFragment) {
it("Models section should be expanded on load", () => {
cy.visit(baseUrl)
.get(".models")
.should("have.class", "is-open")
.get("#model-Pet")
.should("exist")
})
it("Models section should collapse and expand when toggled", () => {
cy.visit(baseUrl)
.get(".models h4 .models-control")
.click()
.get(".models")
.should("not.have.class", "is-open")
.get("#model-Order")
.should("not.exist")
.get(".models h4 .models-control")
.click()
.get(".models")
.should("have.class", "is-open")
.get("#model-Order")
.should("exist")
})
it("Model should collapse and expand when toggled clicking button", () => {
cy.visit(baseUrl)
.get("#model-User .model-box .model-box-control")
.click()
.get("#model-User .model-box .model .inner-object")
.should("exist")
.get("#model-User .model-box .model-box-control")
.click()
.get("#model-User .model-box .model .inner-object")
.should("not.exist")
})
}