all repos — gomponents @ 5da578cfdf717ff1465f729194c8192a00412881

HTML components in pure Go

Group element helpers in different files (#21) According to the section at https://developer.mozilla.org/en-US/docs/Web/HTML/Element

Markus Wüstenberg
commit

5da578cfdf717ff1465f729194c8192a00412881

parent

77b64b13028d94a54491e606eed4dc759ec46dd2

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

changed files
A el/media_test.go
@@ -0,0 +1,15 @@
+package el_test + +import ( + "testing" + + g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/assert" + "github.com/maragudk/gomponents/el" +) + +func TestImg(t *testing.T) { + t.Run("returns an img element with href and alt attributes", func(t *testing.T) { + assert.Equal(t, `<img src="hat.png" alt="hat" id="image" />`, el.Img("hat.png", "hat", g.Attr("id", "image"))) + }) +}