goldsmith/plugins/pager/pager_test.go

37 lines
759 B
Go
Raw Normal View History

2024-02-17 06:35:49 +00:00
package pager
import (
"testing"
"git.foosoft.net/alex/goldsmith"
"git.foosoft.net/alex/goldsmith/harness"
"git.foosoft.net/alex/goldsmith/plugins/collection"
"git.foosoft.net/alex/goldsmith/plugins/frontmatter"
"git.foosoft.net/alex/goldsmith/plugins/layout"
)
func Test(self *testing.T) {
2024-02-20 00:26:41 +00:00
lister := func(file goldsmith.File) interface{} {
2024-02-17 06:35:49 +00:00
if groupsRaw, ok := file.Prop("Groups"); ok {
2024-02-20 00:26:41 +00:00
if groups, ok := groupsRaw.(map[string][]goldsmith.File); ok {
2024-02-17 06:35:49 +00:00
if group, ok := groups["group"]; ok {
return group
}
}
}
return nil
}
harness.Validate(
self,
func(gs *goldsmith.Goldsmith) {
gs.
Chain(frontmatter.New()).
Chain(collection.New()).
Chain(New(lister).ItemsPerPage(4)).
Chain(layout.New())
},
)
}