all repos — gomponents @ ba0d83f4fb1b588f7931b9a31609807adfa11163

HTML components in pure Go

Add examples in test files (#80) These show up in godoc.

Markus Wüstenberg
commit

ba0d83f4fb1b588f7931b9a31609807adfa11163

parent

7c0f2e4cbb4da6d7074bd78be9c55d3495c0dad7

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

changed files
M components/attributes_test.gocomponents/attributes_test.go
@@ -1,6 +1,7 @@
package components_test import ( + "os" "testing" g "github.com/maragudk/gomponents"
@@ -30,3 +31,9 @@ t.FailNow()
} }) } + +func ExampleClasses() { + e := g.El("div", c.Classes{"party-hat": true, "boring-hat": false}) + _ = e.Render(os.Stdout) + // Output: <div class="party-hat"></div> +}