From ef1dc4612d3643b61f9b20ac5d4d70807a08edad Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 9 Feb 2023 19:02:21 -0800 Subject: [PATCH] check root another way --- d2chaos/d2chaos_test.go | 4 ++++ d2ir/d2ir.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/d2chaos/d2chaos_test.go b/d2chaos/d2chaos_test.go index 8b73e4e82..ad7343b5a 100644 --- a/d2chaos/d2chaos_test.go +++ b/d2chaos/d2chaos_test.go @@ -169,6 +169,10 @@ func testPinned(t *testing.T, outDir string) { name: "orientation", text: "a: {\n b\n c\n }\n a <- a.c\n a.b -> a\n", }, + { + name: "cannot create edge between boards", + text: `"" <-> ""`, + }, } for _, tc := range testCases { diff --git a/d2ir/d2ir.go b/d2ir/d2ir.go index 1a90d8d5c..455a38707 100644 --- a/d2ir/d2ir.go +++ b/d2ir/d2ir.go @@ -233,7 +233,7 @@ func NodeBoardKind(n Node) BoardKind { var f *Field switch n := n.(type) { case *Field: - if n.Name == "" { + if n.parent == nil { return BoardLayer } f = ParentField(n)