Skip to content

Commit 6c03465

Browse files
authored
fix: expand model if depth <= defaultModelExpandDepth (#8186)
1 parent 5eeb98b commit 6c03465

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/core/components/primitive-model.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class Primitive extends Component {
5050
</span>
5151

5252
return <span className="model">
53-
<ModelCollapse title={titleEl} expanded={depth >= expandDepth} collapsedContent=" " hideSelfOnExpand={expandDepth !== depth}>
53+
<ModelCollapse title={titleEl} expanded={depth <= expandDepth} collapsedContent="[...]" hideSelfOnExpand={expandDepth !== depth}>
5454
<span className="prop">
5555
{name && depth > 1 && <span className="prop-name">{title}</span>}
5656
<span className="prop-type">{type}</span>

test/e2e-cypress/tests/features/model-collapse.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function ModelCollapseTest(baseUrl, urlFragment) {
4242
.get("#model-User .model-box .model .inner-object")
4343
.should("exist")
4444
.get("#model-User .model-box .model-box-control")
45+
.first()
4546
.click()
4647
.get("#model-User .model-box .model .inner-object")
4748
.should("not.exist")

test/e2e-cypress/tests/features/spec-parse-to-json.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ describe("Parse YAML as [email protected] with json_schema for all JSON-supported types",
1515
// Responses -> schema tab
1616
.get(".model-example > .tab > :nth-child(2)")
1717
.click()
18-
.get(":nth-child(1) > :nth-child(2) > .model > :nth-child(1) > .prop > .property") // first element, without-quotes
18+
.get(":nth-child(1) > :nth-child(2) > .model > :nth-child(1)")
19+
.click()
20+
.get(
21+
":nth-child(1) > :nth-child(2) > .model > :nth-child(1) > .prop > .property"
22+
) // first element, without-quotes
1923
.should("have.text", "example: 1999-11-31")
20-
.get(":nth-child(2) > :nth-child(2) > .model > :nth-child(1) > .prop > .property") // second element, with quotes
24+
.get(":nth-child(2) > :nth-child(2) > .model > :nth-child(1)")
25+
.click()
26+
.get(
27+
":nth-child(2) > :nth-child(2) > .model > :nth-child(1) > .prop > .property"
28+
) // second element, with quotes
2129
.should("have.text", "example: 1999-12-31")
2230
})
2331
})

0 commit comments

Comments
 (0)