about summary refs log tree commit diff stats
path: root/html/attributes_test.go
diff options
context:
space:
mode:
authorMarkus Wüstenberg2020-12-22 11:46:49 +0100
committerGitHub2020-12-22 11:46:49 +0100
commitd41c4e5a85362dec7844a9093b43720eb0e70e72 (patch)
tree8b9fc056e2721b7403e40852de7abb998dcad993 /html/attributes_test.go
parentb4918d5a63434e162e5547cf0e8461fcd1931765 (diff)
downloadgomponents-d41c4e5a85362dec7844a9093b43720eb0e70e72.tar.lz
gomponents-d41c4e5a85362dec7844a9093b43720eb0e70e72.tar.zst
gomponents-d41c4e5a85362dec7844a9093b43720eb0e70e72.zip
Add data- attribute helper (#61)
Fixes #49.
Diffstat (limited to 'html/attributes_test.go')
-rw-r--r--html/attributes_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/html/attributes_test.go b/html/attributes_test.go
index 23445db..b0f76c1 100644
--- a/html/attributes_test.go
+++ b/html/attributes_test.go
@@ -83,3 +83,10 @@ func TestAria(t *testing.T) {
 		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)
+	})
+}