diff options
author | Markus Wüstenberg | 2021-05-05 12:53:32 +0200 |
---|---|---|
committer | GitHub | 2021-05-05 12:53:32 +0200 |
commit | 6f7752c20f605dda102992a984d111cdcd19c57b (patch) | |
tree | dea0456f501b0aea7894fbe8ca689df48f46861e /svg/attributes_test.go | |
parent | eb1d1f22b4a8b59d12e05b813eafcfa629a90df7 (diff) | |
download | gomponents-6f7752c20f605dda102992a984d111cdcd19c57b.tar.lz gomponents-6f7752c20f605dda102992a984d111cdcd19c57b.tar.zst gomponents-6f7752c20f605dda102992a984d111cdcd19c57b.zip |
Add svg package and a few helpers (#67)
Introducing SVG, to inline vector graphics in your HTML! 🥳
Diffstat (limited to 'svg/attributes_test.go')
-rw-r--r-- | svg/attributes_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/svg/attributes_test.go b/svg/attributes_test.go new file mode 100644 index 0000000..41935e8 --- /dev/null +++ b/svg/attributes_test.go @@ -0,0 +1,28 @@ +package svg_test + +import ( + "fmt" + "testing" + + g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/assert" + . "github.com/maragudk/gomponents/svg" +) + +func TestSimpleAttributes(t *testing.T) { + cases := map[string]func(string) g.Node{ + "clip-rule": ClipRule, + "d": D, + "fill": Fill, + "fill-rule": FillRule, + "stroke": Stroke, + "viewBox": ViewBox, + } + + for name, fn := range cases { + t.Run(fmt.Sprintf(`should output %v="hat"`, name), func(t *testing.T) { + n := g.El("element", fn("hat")) + assert.Equal(t, fmt.Sprintf(`<element %v="hat"></element>`, name), n) + }) + } +} |