1
0
gomponents/svg/attributes_test.go

30 lines
671 B
Go
Raw Permalink Normal View History

package svg_test
import (
"fmt"
"testing"
g "github.com/maragudk/gomponents"
"github.com/maragudk/gomponents/internal/assert"
. "github.com/maragudk/gomponents/svg"
)
func TestSimpleAttributes(t *testing.T) {
cases := map[string]func(string) g.Node{
2022-11-15 05:48:01 -08:00
"clip-rule": ClipRule,
"d": D,
"fill": Fill,
"fill-rule": FillRule,
"stroke": Stroke,
"stroke-width": StrokeWidth,
"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)
})
}
}