Created AccessKeyCode type

This commit is contained in:
Brandon Dyck 2019-08-31 12:51:48 -06:00
parent edb347c9ea
commit b24ece723d
2 changed files with 19 additions and 1 deletions

View File

@ -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),
}
}

View File

@ -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)
}