diff options
author | Markus Wüstenberg | 2020-09-25 09:57:47 +0200 |
---|---|---|
committer | GitHub | 2020-09-25 09:57:47 +0200 |
commit | 5da578cfdf717ff1465f729194c8192a00412881 (patch) | |
tree | 9bd1c59936f81efeb4d96edd40043301a97ed606 /el/content_test.go | |
parent | 77b64b13028d94a54491e606eed4dc759ec46dd2 (diff) | |
download | gomponents-5da578cfdf717ff1465f729194c8192a00412881.tar.lz gomponents-5da578cfdf717ff1465f729194c8192a00412881.tar.zst gomponents-5da578cfdf717ff1465f729194c8192a00412881.zip |
Group element helpers in different files (#21)
According to the section at https://developer.mozilla.org/en-US/docs/Web/HTML/Element
Diffstat (limited to 'el/content_test.go')
-rw-r--r-- | el/content_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/el/content_test.go b/el/content_test.go new file mode 100644 index 0000000..b31ad2d --- /dev/null +++ b/el/content_test.go @@ -0,0 +1,39 @@ +package el_test + +import ( + "testing" + + g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/assert" + "github.com/maragudk/gomponents/el" +) + +func TestDiv(t *testing.T) { + t.Run("returns a div element", func(t *testing.T) { + assert.Equal(t, `<div><span /></div>`, el.Div(el.Span())) + }) +} + +func TestOl(t *testing.T) { + t.Run("returns an ol element", func(t *testing.T) { + assert.Equal(t, `<ol><li /></ol>`, el.Ol(el.Li())) + }) +} + +func TestUl(t *testing.T) { + t.Run("returns a ul element", func(t *testing.T) { + assert.Equal(t, `<ul><li /></ul>`, el.Ul(el.Li())) + }) +} + +func TestLi(t *testing.T) { + t.Run("returns an li element", func(t *testing.T) { + assert.Equal(t, `<li>hat</li>`, el.Li(g.Text("hat"))) + }) +} + +func TestP(t *testing.T) { + t.Run("returns a p element", func(t *testing.T) { + assert.Equal(t, `<p>hat</p>`, el.P(g.Text("hat"))) + }) +} |