diff options
Diffstat (limited to 'gomponents_test.go')
-rw-r--r-- | gomponents_test.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/gomponents_test.go b/gomponents_test.go index d8e9e07..ffde46d 100644 --- a/gomponents_test.go +++ b/gomponents_test.go @@ -133,7 +133,7 @@ func TestEl(t *testing.T) { assert.Equal(t, `<div class="hat"><br></div>`, e) }) - t.Run("renders outside if node does not implement placer", func(t *testing.T) { + t.Run("renders outside if node does not implement nodeTypeDescriber", func(t *testing.T) { e := g.El("div", outsider{}) assert.Equal(t, `<div>outsider</div>`, e) }) @@ -248,28 +248,6 @@ func TestGroup(t *testing.T) { }) } -func TestMap(t *testing.T) { - t.Run("maps slices to nodes", func(t *testing.T) { - items := []string{"hat", "partyhat", "turtlehat"} - lis := g.Map(len(items), func(i int) g.Node { - return g.El("li", g.Text(items[i])) - }) - - list := g.El("ul", lis...) - - assert.Equal(t, `<ul><li>hat</li><li>partyhat</li><li>turtlehat</li></ul>`, list) - }) -} - -func ExampleMap() { - items := []string{"party hat", "super hat"} - e := g.El("ul", g.Group(g.Map(len(items), func(i int) g.Node { - return g.El("li", g.Text(items[i])) - }))) - _ = e.Render(os.Stdout) - // Output: <ul><li>party hat</li><li>super hat</li></ul> -} - func TestIf(t *testing.T) { t.Run("returns node if condition is true", func(t *testing.T) { n := g.El("div", g.If(true, g.El("span"))) |