all repos — gomponents @ d41c4e5a85362dec7844a9093b43720eb0e70e72

HTML components in pure Go

Add data- attribute helper (#61) Fixes #49.

Markus Wüstenberg
commit

d41c4e5a85362dec7844a9093b43720eb0e70e72

parent

b4918d5a63434e162e5547cf0e8461fcd1931765

1 file changed, 7 insertions(+), 0 deletions(-)

changed files
M html/attributes_test.gohtml/attributes_test.go
@@ -83,3 +83,10 @@ n := Aria("selected", "true")
assert.Equal(t, ` aria-selected="true"`, n) }) } + +func TestDataAttr(t *testing.T) { + t.Run("returns an attribute which name is prefixed with data-", func(t *testing.T) { + n := DataAttr("id", "partyhat") + assert.Equal(t, ` data-id="partyhat"`, n) + }) +}