diff --git a/src/core/plugins/deep-linking/layout.js b/src/core/plugins/deep-linking/layout.js index 2d7f3624..7104240a 100644 --- a/src/core/plugins/deep-linking/layout.js +++ b/src/core/plugins/deep-linking/layout.js @@ -77,6 +77,13 @@ export const parseDeepLinkHash = (rawHash) => ({ layoutActions, layoutSelectors, const isShownKey = layoutSelectors.isShownKeyFromUrlHashArray(hashArray) + const [type, tagId] = isShownKey + + if(type === "operations") { + // we're going to show an operation, so we need to expand the tag as well + layoutActions.show(layoutSelectors.isShownKeyFromUrlHashArray([tagId])) + } + layoutActions.show(isShownKey, true) // TODO: 'show' operation tag layoutActions.scrollTo(isShownKey) } diff --git a/test/e2e-cypress/tests/deep-linking.js b/test/e2e-cypress/tests/deep-linking.js index 9aad615e..4f51e143 100644 --- a/test/e2e-cypress/tests/deep-linking.js +++ b/test/e2e-cypress/tests/deep-linking.js @@ -71,6 +71,19 @@ describe("Deep linking feature", () => { .should("exist") }) }) + + describe("regular Operation with `docExpansion: none` enabled", function() { + it("should expand a tag", () => { + cy.visit(`${baseUrl}&docExpansion=none#/myTag`) + .get(`.opblock-tag-section.is-open`) + .should("have.length", 1) + }) + it("should expand an operation", () => { + cy.visit(`${baseUrl}&docExpansion=none#/myTag/myOperation`) + .get(`.opblock.is-open`) + .should("have.length", 1) + }) + }) }) describe("in OpenAPI 3", () => { const baseUrl = "/?deepLinking=true&url=/documents/features/deep-linking.swagger.yaml" @@ -144,5 +157,18 @@ describe("Deep linking feature", () => { .should("exist") }) }) + + describe("regular Operation with `docExpansion: none` enabled", function () { + it("should expand a tag", () => { + cy.visit(`${baseUrl}&docExpansion=none#/myTag`) + .get(`.opblock-tag-section.is-open`) + .should("have.length", 1) + }) + it("should expand an operation", () => { + cy.visit(`${baseUrl}&docExpansion=none#/myTag/myOperation`) + .get(`.opblock.is-open`) + .should("have.length", 1) + }) + }) }) }) \ No newline at end of file