about summary refs log tree commit diff stats
path: root/components/documents_test.go
diff options
context:
space:
mode:
authorMarkus Wüstenberg2020-12-10 13:00:23 +0100
committerGitHub2020-12-10 13:00:23 +0100
commita76262652b227c95ce140f3698c46f59b79354ac (patch)
tree15987ad4a4a4f830f0df9fc110faf667fe83514a /components/documents_test.go
parenta7e24c6cddaafb98091c3989c9da7779eeba30b5 (diff)
downloadgomponents-a76262652b227c95ce140f3698c46f59b79354ac.tar.lz
gomponents-a76262652b227c95ce140f3698c46f59b79354ac.tar.zst
gomponents-a76262652b227c95ce140f3698c46f59b79354ac.zip
Move elements and attributes into html package (#52)
This makes it easier to use dot-imports.

Also updated the readme and examples with new usage, and move the `Classes` helper into the `components` package.
Diffstat (limited to 'components/documents_test.go')
-rw-r--r--components/documents_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/components/documents_test.go b/components/documents_test.go
index 863ac96..07f8697 100644
--- a/components/documents_test.go
+++ b/components/documents_test.go
@@ -5,26 +5,25 @@ import (
 
 	g "github.com/maragudk/gomponents"
 	"github.com/maragudk/gomponents/assert"
-	"github.com/maragudk/gomponents/attr"
-	c "github.com/maragudk/gomponents/components"
-	"github.com/maragudk/gomponents/el"
+	. "github.com/maragudk/gomponents/components"
+	. "github.com/maragudk/gomponents/html"
 )
 
 func TestHTML5(t *testing.T) {
 	t.Run("returns an html5 document template", func(t *testing.T) {
-		e := c.HTML5(c.DocumentProps{
+		e := HTML5(HTML5Props{
 			Title:       "Hat",
 			Description: "Love hats.",
 			Language:    "en",
-			Head:        []g.Node{el.Link(attr.Rel("stylesheet"), attr.Href("/hat.css"))},
-			Body:        []g.Node{el.Div()},
+			Head:        []g.Node{Link(Rel("stylesheet"), Href("/hat.css"))},
+			Body:        []g.Node{Div()},
 		})
 
 		assert.Equal(t, `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Hat</title><meta name="description" content="Love hats."><link rel="stylesheet" href="/hat.css"></head><body><div></div></body></html>`, e)
 	})
 
 	t.Run("returns no language, description, and extra head/body elements if empty", func(t *testing.T) {
-		e := c.HTML5(c.DocumentProps{
+		e := HTML5(HTML5Props{
 			Title: "Hat",
 		})