Skip to content

Commit

Permalink
folder check
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 29, 2023
1 parent 3b0939f commit 167a5c7
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 9 deletions.
3 changes: 3 additions & 0 deletions d2compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func (c *compiler) compileBoard(g *d2graph.Graph, ir *d2ir.Map) *d2graph.Graph {
g.IsFolderOnly = true
}
}
if len(g.Objects) == 0 {
g.IsFolderOnly = true
}
return g
}

Expand Down
15 changes: 15 additions & 0 deletions d2compiler/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2832,6 +2832,21 @@ layers: {
assert.False(t, g.Layers[1].Scenarios[1].IsFolderOnly)
},
},
{
name: "isFolderOnly-shapes",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
direction: right
steps: {
1: {
RJ
}
}
`, "")
assert.True(t, g.IsFolderOnly)
},
},
{
name: "scenarios_edge_index",
run: func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/d2compiler/TestCompile/root_direction.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/d2compiler/TestCompile/root_sequence.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

287 changes: 287 additions & 0 deletions testdata/d2compiler/TestCompile2/boards/isFolderOnly-shapes.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 167a5c7

Please sign in to comment.