diff --git a/attribute/accesskey.go b/attribute/accesskey.go index a1bcede..b593de1 100644 --- a/attribute/accesskey.go +++ b/attribute/accesskey.go @@ -2,9 +2,15 @@ package attribute import "gitlab.codemonkeysoftware.net/b/hatmill" +type AccessKeyCode rune + +func (c AccessKeyCode) String() string { + return string([]rune{rune(c)}) +} + func Accesskey(value rune) hatmill.Attrib { return hatmill.Attrib{ Key: "accesskey", - Value: String([]rune{value}), + Value: AccessKeyCode(value), } } diff --git a/attribute/accesskey_test.go b/attribute/accesskey_test.go new file mode 100644 index 0000000..16404bb --- /dev/null +++ b/attribute/accesskey_test.go @@ -0,0 +1,12 @@ +package attribute_test + +import ( + "gitlab.codemonkeysoftware.net/b/hatmill/attribute" + "testing" +) + +func TestAccessKeyString(t *testing.T) { + actual := attribute.AccessKeyCode('a').String() + expected := "a" + expectEqualStrings(t, actual, expected) +}