From 6f7752c20f605dda102992a984d111cdcd19c57b Mon Sep 17 00:00:00 2001 From: Markus Wüstenberg Date: Wed, 5 May 2021 12:53:32 +0200 Subject: Add svg package and a few helpers (#67) Introducing SVG, to inline vector graphics in your HTML! 🥳--- svg/elements_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 svg/elements_test.go (limited to 'svg/elements_test.go') diff --git a/svg/elements_test.go b/svg/elements_test.go new file mode 100644 index 0000000..1b5e9d8 --- /dev/null +++ b/svg/elements_test.go @@ -0,0 +1,29 @@ +package svg_test + +import ( + "fmt" + "testing" + + g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/assert" + . "github.com/maragudk/gomponents/svg" +) + +func TestSimpleElements(t *testing.T) { + cases := map[string]func(...g.Node) g.Node{ + "path": Path, + } + + for name, fn := range cases { + t.Run(fmt.Sprintf("should output %v", name), func(t *testing.T) { + n := fn(g.Attr("id", "hat")) + assert.Equal(t, fmt.Sprintf(`<%v id="hat">`, name, name), n) + }) + } +} + +func TestSVG(t *testing.T) { + t.Run("outputs svg element with xml namespace attribute", func(t *testing.T) { + assert.Equal(t, ``, SVG(g.El("path"))) + }) +} -- cgit 1.4.1