diff --git a/src/core/components/operation-tag.jsx b/src/core/components/operation-tag.jsx index 8dbc39a5..48c7b273 100644 --- a/src/core/components/operation-tag.jsx +++ b/src/core/components/operation-tag.jsx @@ -59,7 +59,7 @@ export default class OperationTag extends React.Component { let rawTagExternalDocsUrl = tagObj.getIn(["tagDetails", "externalDocs", "url"]) let tagExternalDocsUrl if (isFunc(oas3Selectors) && isFunc(oas3Selectors.selectedServer)) { - tagExternalDocsUrl = safeBuildUrl( rawTagExternalDocsUrl, specUrl, { selectedServer: oas3Selectors.selectedServer() } ) + tagExternalDocsUrl = safeBuildUrl(rawTagExternalDocsUrl, specUrl, { selectedServer: oas3Selectors.selectedServer() }) } else { tagExternalDocsUrl = rawTagExternalDocsUrl } @@ -72,48 +72,49 @@ export default class OperationTag extends React.Component {

layoutActions.show(isShownKey, !showTag)} - className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" } + className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag"} id={isShownKey.map(v => escapeDeepLinkPath(v)).join("-")} data-tag={tag} data-is-open={showTag} - > + > - { !tagDescription ? : + {!tagDescription ? : - - - } + + + } -
- { !tagExternalDocsDescription ? null : - - { tagExternalDocsDescription } - { tagExternalDocsUrl ? ": " : null } - { tagExternalDocsUrl ? - e.stopPropagation()} - target="_blank" - >{tagExternalDocsUrl} : null - } - + {!tagExternalDocsDescription ? null : +
+ + {tagExternalDocsDescription} + {tagExternalDocsUrl ? ": " : null} + {tagExternalDocsUrl ? + e.stopPropagation()} + target="_blank" + >{tagExternalDocsUrl} : null } +
+ } - +

diff --git a/test/e2e-cypress/static/documents/bugs/7996-tags-externalDocs.yaml b/test/e2e-cypress/static/documents/bugs/7996-tags-externalDocs.yaml new file mode 100644 index 00000000..8c3eef4f --- /dev/null +++ b/test/e2e-cypress/static/documents/bugs/7996-tags-externalDocs.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.2 +info: + title: "This is an example highlighting a display issue related to `tags` and `description` entries therein. It contains tag descriptions with & without externalDocs." + version: 1.0.0 +tags: +- name: "foo" + description: "Foo: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex\ + ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + externalDocs: + description: "Find out more" + url: "http://swagger.io" +- name: "bar" + description: "Bar: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex \ +ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +- name: "baz" + description: "Baz: has less description text" + externalDocs: + description: "Find out more about our store" + url: "http://swagger.io" +paths: + /foobar: + get: + tags: + - "foo" + - "bar" + responses: + '200': + description: OK \ No newline at end of file diff --git a/test/e2e-cypress/tests/bugs/7996.js b/test/e2e-cypress/tests/bugs/7996.js new file mode 100644 index 00000000..cb042deb --- /dev/null +++ b/test/e2e-cypress/tests/bugs/7996.js @@ -0,0 +1,14 @@ +describe("#7996: tag description text fills container when externalDocs section absent", () => { + it("should show externalDocs div when externalDocs present in specification", () => { + cy + .visit("?url=/documents/bugs/7996-tags-externalDocs.yaml") + .get("#operations-tag-foo .info__externaldocs") + .should("exist") + }) + it("should have no externalDocs div when externalDocs absent from specification", () => { + cy + .visit("?url=/documents/bugs/7996-tags-externalDocs.yaml") + .get("#operations-tag-bar .info__externaldocs") + .should("not.exist") + }) +})