Created AccessKeyCode type
This commit is contained in:
parent
edb347c9ea
commit
b24ece723d
@ -2,9 +2,15 @@ package attribute
|
|||||||
|
|
||||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
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 {
|
func Accesskey(value rune) hatmill.Attrib {
|
||||||
return hatmill.Attrib{
|
return hatmill.Attrib{
|
||||||
Key: "accesskey",
|
Key: "accesskey",
|
||||||
Value: String([]rune{value}),
|
Value: AccessKeyCode(value),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
attribute/accesskey_test.go
Normal file
12
attribute/accesskey_test.go
Normal 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)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user