-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update unit test to be more descriptive
- Loading branch information
Showing
4 changed files
with
186 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
<div><h1>Luiz Bonfa</h1><div style="font-family: 'sans-serif'" id="test" data-contents="something with "quotes" and a <tag>"><div>email:<a href="mailto: [email protected]">[email protected]</a></div></div></div> | ||
|
||
<div>A</div> | ||
<div>B</div> | ||
<div>C</div> | ||
<div>Legacy call style</div> | ||
<div id="wrapper"> | ||
<div>Child content</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,7 @@ import ( | |
var expected string | ||
|
||
func Test(t *testing.T) { | ||
component := personTemplate(person{ | ||
name: "Luiz Bonfa", | ||
email: "[email protected]", | ||
}) | ||
component := showAll() | ||
|
||
diff, err := htmldiff.Diff(component, expected) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
package testcall | ||
|
||
templ personTemplate(p person) { | ||
<div> | ||
<h1>{ p.name }</h1> | ||
<div style="font-family: 'sans-serif'" id="test" data-contents={ `something with "quotes" and a <tag>` }> | ||
{! email(p.email) } | ||
</div> | ||
</div> | ||
templ showAll() { | ||
@a() | ||
@b(c("C")) | ||
{! d() } | ||
@wrapChildren() { | ||
<div>Child content</div> | ||
} | ||
} | ||
|
||
templ a() { | ||
<div>A</div> | ||
} | ||
|
||
templ b(child templ.Component) { | ||
<div>B</div> | ||
@child | ||
} | ||
|
||
templ email(s string) { | ||
<div>email:<a href={ templ.URL("mailto: " + s) }>{ s }</a></div> | ||
templ c(text string) { | ||
<div>{ text }</div> | ||
} | ||
|
||
templ d() { | ||
<div>Legacy call style</div> | ||
} | ||
|
||
templ wrapChildren() { | ||
<div id="wrapper"> | ||
{ children... } | ||
</div> | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.