diff options
author | Markus Wüstenberg | 2020-10-28 16:16:18 +0100 |
---|---|---|
committer | GitHub | 2020-10-28 16:16:18 +0100 |
commit | 18e90339fcac48806a5777766aeb256be2b8c4bc (patch) | |
tree | 7b5bd103e15db8a4ed81981e6b83b0d547d34540 /el/section_test.go | |
parent | 8f17dba6f1268ab8c8810d7940d1484315cdb825 (diff) | |
download | gomponents-18e90339fcac48806a5777766aeb256be2b8c4bc.tar.lz gomponents-18e90339fcac48806a5777766aeb256be2b8c4bc.tar.zst gomponents-18e90339fcac48806a5777766aeb256be2b8c4bc.zip |
Add element helpers and refactor (#34)
This change adds a lot of element helpers, and refactors: - helpers into simple, text, and other helpers - most tests into table-driven tests, so they're easier to read Thanks to @oderwat for pushing me to improve the tests. 😉
Diffstat (limited to 'el/section_test.go')
-rw-r--r-- | el/section_test.go | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/el/section_test.go b/el/section_test.go deleted file mode 100644 index 11c60fb..0000000 --- a/el/section_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package el_test - -import ( - "testing" - - g "github.com/maragudk/gomponents" - "github.com/maragudk/gomponents/assert" - "github.com/maragudk/gomponents/el" -) - -func TestAddress(t *testing.T) { - t.Run("returns an address element", func(t *testing.T) { - assert.Equal(t, `<address />`, el.Address()) - }) -} - -func TestArticle(t *testing.T) { - t.Run("returns an article element", func(t *testing.T) { - assert.Equal(t, `<article />`, el.Article()) - }) -} - -func TestAside(t *testing.T) { - t.Run("returns an aside element", func(t *testing.T) { - assert.Equal(t, `<aside />`, el.Aside()) - }) -} - -func TestFooter(t *testing.T) { - t.Run("returns a footer element", func(t *testing.T) { - assert.Equal(t, `<footer />`, el.Footer()) - }) -} - -func TestHeader(t *testing.T) { - t.Run("returns a header element", func(t *testing.T) { - assert.Equal(t, `<header />`, el.Header()) - }) -} - -func TestH1(t *testing.T) { - t.Run("returns an h1 element", func(t *testing.T) { - assert.Equal(t, `<h1 id="headline">hat</h1>`, el.H1("hat", g.Attr("id", "headline"))) - }) -} - -func TestH2(t *testing.T) { - t.Run("returns an h2 element", func(t *testing.T) { - assert.Equal(t, `<h2 id="headline">hat</h2>`, el.H2("hat", g.Attr("id", "headline"))) - }) -} - -func TestH3(t *testing.T) { - t.Run("returns an h3 element", func(t *testing.T) { - assert.Equal(t, `<h3 id="headline">hat</h3>`, el.H3("hat", g.Attr("id", "headline"))) - }) -} - -func TestH4(t *testing.T) { - t.Run("returns an h4 element", func(t *testing.T) { - assert.Equal(t, `<h4 id="headline">hat</h4>`, el.H4("hat", g.Attr("id", "headline"))) - }) -} - -func TestH5(t *testing.T) { - t.Run("returns an h5 element", func(t *testing.T) { - assert.Equal(t, `<h5 id="headline">hat</h5>`, el.H5("hat", g.Attr("id", "headline"))) - }) -} - -func TestH6(t *testing.T) { - t.Run("returns an h6 element", func(t *testing.T) { - assert.Equal(t, `<h6 id="headline">hat</h6>`, el.H6("hat", g.Attr("id", "headline"))) - }) -} - -func TestHGroup(t *testing.T) { - t.Run("returns an hgroup element", func(t *testing.T) { - assert.Equal(t, `<hgroup />`, el.HGroup()) - }) -} - -func TestMainEl(t *testing.T) { - t.Run("returns a main element", func(t *testing.T) { - assert.Equal(t, `<main />`, el.Main()) - }) -} - -func TestNav(t *testing.T) { - t.Run("returns a nav element", func(t *testing.T) { - assert.Equal(t, `<nav />`, el.Nav()) - }) -} - -func TestSection(t *testing.T) { - t.Run("returns a section element", func(t *testing.T) { - assert.Equal(t, `<section />`, el.Section()) - }) -} |