all repos — gomponents @ c6c5fbd0f92667d9a98a232b455ea26180017e4d

HTML components in pure Go

Add br and hr element helpers (#30)

Hans Raaf
commit

c6c5fbd0f92667d9a98a232b455ea26180017e4d

parent

c99025e6c569827aa5ca8fb3e16545f1b5f821f2

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

changed files
M el/content_test.goel/content_test.go
@@ -37,3 +37,15 @@ t.Run("returns a p element", func(t *testing.T) {
assert.Equal(t, `<p>hat</p>`, el.P(g.Text("hat"))) }) } + +func TestBr(t *testing.T) { + t.Run("returns a br element in context", func(t *testing.T) { + assert.Equal(t, `<p>Test<br />Me</p>`, el.P(g.Text("Test"), el.Br(), g.Text("Me"))) + }) +} + +func TestHr(t *testing.T) { + t.Run("returns a hr element with class", func(t *testing.T) { + assert.Equal(t, `<hr class="test" />`, el.Hr(g.Attr("class", "test"))) + }) +}