all repos — gomponents @ 6efec2175f61125c3cae694b9a4327a990484ca0

HTML components in pure Go

Add aria-* and role attributes (#59) Fixes #50.

Markus Wüstenberg
commit

6efec2175f61125c3cae694b9a4327a990484ca0

parent

f22ce3fb68ca6702a683b7759410ae50a9fddabd

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

changed files
M html/attributes_test.gohtml/attributes_test.go
@@ -57,6 +57,7 @@ "pattern": Pattern,
"preload": Preload, "placeholder": Placeholder, "rel": Rel, + "role": Role, "rows": Rows, "src": Src, "style": StyleAttr,
@@ -75,3 +76,10 @@ assert.Equal(t, fmt.Sprintf(`<div %v="hat"></div>`, name), n)
}) } } + +func TestAria(t *testing.T) { + t.Run("returns an attribute which name is prefixed with aria-", func(t *testing.T) { + n := Aria("selected", "true") + assert.Equal(t, ` aria-selected="true"`, n) + }) +}