Refactor template build tests to use advanced template in sui/storages/local/build_test.go
This commit is contained in:
parent
b6e2d3ae8e
commit
a91e47b072
1 changed files with 17 additions and 17 deletions
|
|
@ -56,7 +56,7 @@ func TestTemplateBuildAsComponent(t *testing.T) {
|
||||||
tests := prepare(t)
|
tests := prepare(t)
|
||||||
defer clean()
|
defer clean()
|
||||||
|
|
||||||
tmpl, err := tests.Web.GetTemplate("default")
|
tmpl, err := tests.Test.GetTemplate("advanced")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("GetTemplate error: %v", err)
|
t.Fatalf("GetTemplate error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -76,15 +76,15 @@ func TestTemplateBuildAsComponent(t *testing.T) {
|
||||||
t.Fatalf("Components error: %v", err)
|
t.Fatalf("Components error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cselect := "/flowbite/components/edit/select.jit"
|
block := "/i18n/block.jit"
|
||||||
cinput := "/flowbite/components/edit/input.jit"
|
bar := "/backend/bar.jit"
|
||||||
|
|
||||||
// Check JIT
|
// Check JIT
|
||||||
assert.FileExists(t, filepath.Join(path, cselect))
|
assert.FileExists(t, filepath.Join(path, block))
|
||||||
assert.FileExists(t, filepath.Join(path, cinput))
|
assert.FileExists(t, filepath.Join(path, bar))
|
||||||
assert.Len(t, warnings, 0)
|
assert.Len(t, warnings, 0)
|
||||||
|
|
||||||
content, err := os.ReadFile(filepath.Join(path, cselect))
|
content, err := os.ReadFile(filepath.Join(path, bar))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("ReadFile error: %v", err)
|
t.Fatalf("ReadFile error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -96,8 +96,8 @@ func TestTemplateBuildAsComponent(t *testing.T) {
|
||||||
assert.Contains(t, string(content), `<script name="scripts" type="json">`)
|
assert.Contains(t, string(content), `<script name="scripts" type="json">`)
|
||||||
assert.Contains(t, string(content), `<script name="styles" type="json">`)
|
assert.Contains(t, string(content), `<script name="styles" type="json">`)
|
||||||
assert.Contains(t, string(content), `<script name="option" type="json">`)
|
assert.Contains(t, string(content), `<script name="option" type="json">`)
|
||||||
assert.Contains(t, string(content), "function Init()")
|
assert.Contains(t, string(content), "this.Constants")
|
||||||
assert.Contains(t, string(content), `type="flowbite-edit-select"`)
|
assert.Contains(t, string(content), `type="hook-bar"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPageBuild(t *testing.T) {
|
func TestPageBuild(t *testing.T) {
|
||||||
|
|
@ -150,7 +150,7 @@ func TestPageBuildAsComponent(t *testing.T) {
|
||||||
tests := prepare(t)
|
tests := prepare(t)
|
||||||
defer clean()
|
defer clean()
|
||||||
|
|
||||||
tmpl, err := tests.Web.GetTemplate("default")
|
tmpl, err := tests.Test.GetTemplate("advanced")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("GetTemplate error: %v", err)
|
t.Fatalf("GetTemplate error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ func TestPageBuildAsComponent(t *testing.T) {
|
||||||
t.Fatalf("RemoveAll error: %v", err)
|
t.Fatalf("RemoveAll error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
page, err := tmpl.Page("/[form]")
|
page, err := tmpl.Page("/backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Page error: %v", err)
|
t.Fatalf("Page error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -176,14 +176,14 @@ func TestPageBuildAsComponent(t *testing.T) {
|
||||||
}
|
}
|
||||||
assert.Len(t, warnings, 0)
|
assert.Len(t, warnings, 0)
|
||||||
|
|
||||||
cselect := "/flowbite/components/edit/select.jit"
|
foo := "/backend/foo.jit"
|
||||||
cinput := "/flowbite/components/edit/input.jit"
|
bar := "/backend/bar.jit"
|
||||||
|
|
||||||
// Check JIT
|
// Check JIT
|
||||||
assert.FileExists(t, filepath.Join(path, cselect))
|
assert.FileExists(t, filepath.Join(path, foo))
|
||||||
assert.FileExists(t, filepath.Join(path, cinput))
|
assert.FileExists(t, filepath.Join(path, bar))
|
||||||
|
|
||||||
content, err := os.ReadFile(filepath.Join(path, cselect))
|
content, err := os.ReadFile(filepath.Join(path, bar))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("ReadFile error: %v", err)
|
t.Fatalf("ReadFile error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -195,8 +195,8 @@ func TestPageBuildAsComponent(t *testing.T) {
|
||||||
assert.Contains(t, string(content), `<script name="scripts" type="json">`)
|
assert.Contains(t, string(content), `<script name="scripts" type="json">`)
|
||||||
assert.Contains(t, string(content), `<script name="styles" type="json">`)
|
assert.Contains(t, string(content), `<script name="styles" type="json">`)
|
||||||
assert.Contains(t, string(content), `<script name="option" type="json">`)
|
assert.Contains(t, string(content), `<script name="option" type="json">`)
|
||||||
assert.Contains(t, string(content), "function Init()")
|
assert.Contains(t, string(content), "this.Constants")
|
||||||
assert.Contains(t, string(content), `type="flowbite-edit-select"`)
|
assert.Contains(t, string(content), `type="hook-bar"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPageTrans(t *testing.T) {
|
func TestPageTrans(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue