all repos — gomponents @ 5929ba8c41859ca9ea4117f42525e7be370ff55f

HTML components in pure Go

Add convenience helpers for form elements (#19)

Markus Wüstenberg
commit

5929ba8c41859ca9ea4117f42525e7be370ff55f

parent

4c109f9f1d4db4733d267ece171a533521029bdb

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

changed files
A attr/forms_test.go
@@ -0,0 +1,16 @@
+package attr_test + +import ( + "testing" + + g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/assert" + "github.com/maragudk/gomponents/attr" +) + +func TestForms(t *testing.T) { + t.Run("adds placeholder and required attributes", func(t *testing.T) { + e := g.El("input", attr.Placeholder("hat"), attr.Required()) + assert.Equal(t, `<input placeholder="hat" required/>`, e) + }) +}