about summary refs log tree commit diff stats
path: root/svg/attributes_test.go
blob: 41935e867e97bec854a4b1d236ad287217d3d382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
		})
	}
}