[_]
This commit is contained in:
parent
26b03fe8a0
commit
4015573f5b
2 changed files with 24 additions and 3 deletions
|
|
@ -72,9 +72,27 @@ func testPage(t *testing.T) *Page {
|
||||||
<div>{{ idx }} {{ article.title }}</div>
|
<div>{{ idx }} {{ article.title }}</div>
|
||||||
<div>{{ article.desc }}</div>
|
<div>{{ article.desc }}</div>
|
||||||
<div>{{ article.type == "article" ? "article" : "others"}}</div>
|
<div>{{ article.type == "article" ? "article" : "others"}}</div>
|
||||||
<div s:if="article.type == 'article'">article</div>
|
|
||||||
<div s:elif="article.type == 'image'">image</div>
|
<div class="mt-10">IF</div>
|
||||||
<div s:else>others</div>
|
<div class="p-5">
|
||||||
|
<div s:if="article.type == 'article'">article</div>
|
||||||
|
<div s:elif="article.type == 'image'">image</div>
|
||||||
|
<div s:else>others</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-10">Nested</div>
|
||||||
|
<div
|
||||||
|
s:for="article.images"
|
||||||
|
s:for-item="image"
|
||||||
|
s:for-index="imgIndex"
|
||||||
|
class="p-5"
|
||||||
|
>
|
||||||
|
<div s:if="imgIndex == 1 || imgIndex == 2" class="p-5">
|
||||||
|
{{ imgIndex }} {{ image }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-10">IF</div>
|
<div class="mt-10">IF</div>
|
||||||
<div s:if="len(articles) > 0" :name="input.data">
|
<div s:if="len(articles) > 0" :name="input.data">
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/yaoapp/kun/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRender(t *testing.T) {
|
func TestRender(t *testing.T) {
|
||||||
|
|
@ -29,6 +30,8 @@ func TestRender(t *testing.T) {
|
||||||
t.Fatalf("Render error: %v", err)
|
t.Fatalf("Render error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.Dump(html)
|
||||||
|
|
||||||
assert.NotEmpty(t, html)
|
assert.NotEmpty(t, html)
|
||||||
assert.Contains(t, html, "hello space")
|
assert.Contains(t, html, "hello space")
|
||||||
assert.Equal(t, 0, len(parser.errors))
|
assert.Equal(t, 0, len(parser.errors))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue