From d41c4e5a85362dec7844a9093b43720eb0e70e72 Mon Sep 17 00:00:00 2001 From: Markus Wüstenberg Date: Tue, 22 Dec 2020 11:46:49 +0100 Subject: Add data- attribute helper (#61) Fixes #49.--- html/attributes_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'html/attributes_test.go') 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) + }) +} -- cgit 1.4.1