From 8f4f4303823ddced5b2b7becae2e4e96552fcf3c Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 20 Jan 2025 14:54:07 -0800 Subject: [PATCH] add test --- d2compiler/compile_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 35055cb56..520d7ca04 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -5197,6 +5197,23 @@ y.link: https://google.com assert.Equal(t, "true", g.Objects[1].Attributes.Style.Underline.Value) }, }, + { + name: "exists-filter", + run: func(t *testing.T) { + g, _ := assertCompile(t, ` +**.style.fill: red { + &leaf: false +} +a.b.c +`, ``) + assert.Equal(t, "a", g.Objects[0].ID) + assert.Equal(t, "red", g.Objects[0].Attributes.Style.Fill.Value) + assert.Equal(t, "b", g.Objects[1].Attributes.Style.Fill.Value) + assert.Equal(t, "red", g.Objects[1].Attributes.Style.Fill.Value) + assert.Equal(t, "c", g.Objects[2].Attributes.Style.Fill.Value) + assert.NotEqual(t, "red", g.Objects[2].Attributes.Style.Fill.Value) + }, + }, { name: "glob-filter", run: func(t *testing.T) {