add tests for custom functions

This commit is contained in:
2025-09-09 23:14:03 -06:00
parent a899fd6c4d
commit 6dfe71894d
2 changed files with 501 additions and 34 deletions

View File

@ -185,45 +185,55 @@ func createTestAST() lang.AST {
Name: "HomePage",
Path: "/",
Layout: "public",
Components: []lang.Component{
{Type: "header"},
{Type: "footer"},
},
Sections: []lang.Section{
Elements: []lang.PageElement{
{
Name: "hero",
Type: strPtr("container"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "carousel",
Component: &lang.Component{
Type: "header",
},
},
{
Component: &lang.Component{
Type: "footer",
},
},
{
Section: &lang.Section{
Name: "hero",
Type: strPtr("container"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "carousel",
},
},
},
{
Section: &lang.Section{
Name: "banner",
Type: strPtr("panel"),
{
Section: &lang.Section{
Name: "banner",
Type: strPtr("panel"),
},
},
},
},
},
{
Name: "content",
Type: strPtr("container"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "article",
Section: &lang.Section{
Name: "content",
Type: strPtr("container"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "article",
},
},
},
{
Section: &lang.Section{
Name: "sidebar",
Type: strPtr("panel"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "widget",
{
Section: &lang.Section{
Name: "sidebar",
Type: strPtr("panel"),
Elements: []lang.SectionElement{
{
Component: &lang.Component{
Type: "widget",
},
},
},
},
@ -240,10 +250,12 @@ func createTestAST() lang.AST {
Name: "AdminPage",
Path: "/admin",
Layout: "admin",
Sections: []lang.Section{
Elements: []lang.PageElement{
{
Name: "dashboard",
Type: strPtr("container"),
Section: &lang.Section{
Name: "dashboard",
Type: strPtr("container"),
},
},
},
},