fix: expand model if depth <= defaultModelExpandDepth (#8186)

This commit is contained in:
twjasa
2022-09-21 19:57:37 -03:00
committed by GitHub
parent 5eeb98b8d6
commit 6c03465257
3 changed files with 12 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ export default class Primitive extends Component {
</span> </span>
return <span className="model"> return <span className="model">
<ModelCollapse title={titleEl} expanded={depth >= expandDepth} collapsedContent=" " hideSelfOnExpand={expandDepth !== depth}> <ModelCollapse title={titleEl} expanded={depth <= expandDepth} collapsedContent="[...]" hideSelfOnExpand={expandDepth !== depth}>
<span className="prop"> <span className="prop">
{name && depth > 1 && <span className="prop-name">{title}</span>} {name && depth > 1 && <span className="prop-name">{title}</span>}
<span className="prop-type">{type}</span> <span className="prop-type">{type}</span>

View File

@@ -42,6 +42,7 @@ function ModelCollapseTest(baseUrl, urlFragment) {
.get("#model-User .model-box .model .inner-object") .get("#model-User .model-box .model .inner-object")
.should("exist") .should("exist")
.get("#model-User .model-box .model-box-control") .get("#model-User .model-box .model-box-control")
.first()
.click() .click()
.get("#model-User .model-box .model .inner-object") .get("#model-User .model-box .model .inner-object")
.should("not.exist") .should("not.exist")

View File

@@ -15,9 +15,17 @@ describe("Parse YAML as YAML@1.2 with json_schema for all JSON-supported types",
// Responses -> schema tab // Responses -> schema tab
.get(".model-example > .tab > :nth-child(2)") .get(".model-example > .tab > :nth-child(2)")
.click() .click()
.get(":nth-child(1) > :nth-child(2) > .model > :nth-child(1) > .prop > .property") // first element, without-quotes .get(":nth-child(1) > :nth-child(2) > .model > :nth-child(1)")
.click()
.get(
":nth-child(1) > :nth-child(2) > .model > :nth-child(1) > .prop > .property"
) // first element, without-quotes
.should("have.text", "example: 1999-11-31") .should("have.text", "example: 1999-11-31")
.get(":nth-child(2) > :nth-child(2) > .model > :nth-child(1) > .prop > .property") // second element, with quotes .get(":nth-child(2) > :nth-child(2) > .model > :nth-child(1)")
.click()
.get(
":nth-child(2) > :nth-child(2) > .model > :nth-child(1) > .prop > .property"
) // second element, with quotes
.should("have.text", "example: 1999-12-31") .should("have.text", "example: 1999-12-31")
}) })
}) })