all repos — gomponents @ b4918d5a63434e162e5547cf0e8461fcd1931765

HTML components in pure Go

Add test for InputHidden (#60)

Markus Wüstenberg markus@maragu.dk
Tue, 22 Dec 2020 11:12:45 +0100
commit

b4918d5a63434e162e5547cf0e8461fcd1931765

parent

6efec2175f61125c3cae694b9a4327a990484ca0

1 files changed, 16 insertions(+), 0 deletions(-)

jump to
A components/elements_test.go
@@ -0,0 +1,16 @@+package components_test
+
+import (
+	"testing"
+
+	g "github.com/maragudk/gomponents"
+	"github.com/maragudk/gomponents/assert"
+	c "github.com/maragudk/gomponents/components"
+)
+
+func TestInputHidden(t *testing.T) {
+	t.Run("returns an input element with type hidden, and the given name and value", func(t *testing.T) {
+		n := c.InputHidden("id", "partyhat", g.Attr("class", "hat"))
+		assert.Equal(t, `<input type="hidden" name="id" value="partyhat" class="hat">`, n)
+	})
+}