Skip to content

Commit

Permalink
fix: expand model if depth <= defaultModelExpandDepth (#8186)
Browse files Browse the repository at this point in the history
  • Loading branch information
twjasa committed Sep 21, 2022
1 parent 5eeb98b commit 6c03465
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/components/primitive-model.jsx
Expand Up @@ -50,7 +50,7 @@ export default class Primitive extends Component {
</span>

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">
{name && depth > 1 && <span className="prop-name">{title}</span>}
<span className="prop-type">{type}</span>
Expand Down
1 change: 1 addition & 0 deletions test/e2e-cypress/tests/features/model-collapse.js
Expand Up @@ -42,6 +42,7 @@ function ModelCollapseTest(baseUrl, urlFragment) {
.get("#model-User .model-box .model .inner-object")
.should("exist")
.get("#model-User .model-box .model-box-control")
.first()
.click()
.get("#model-User .model-box .model .inner-object")
.should("not.exist")
Expand Down
12 changes: 10 additions & 2 deletions test/e2e-cypress/tests/features/spec-parse-to-json.js
Expand Up @@ -15,9 +15,17 @@ describe("Parse YAML as YAML@1.2 with json_schema for all JSON-supported types",
// Responses -> schema tab
.get(".model-example > .tab > :nth-child(2)")
.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")
.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")
})
})

0 comments on commit 6c03465

Please sign in to comment.