fix template test renderer, add category

This commit is contained in:
41666 2025-04-06 22:27:42 -07:00
parent d9146750ba
commit e4317ec4fd
15 changed files with 171 additions and 103 deletions

View file

@ -38,13 +38,37 @@ func (t *TestingController) TestTemplate(c fiber.Ctx) error {
which := c.Params("which")
cat1 := fixtures.Category(fixtures.CategoryMulti)
cat2 := fixtures.Category(fixtures.CategorySingle)
cat3 := fixtures.Category(fixtures.CategoryMulti)
cat4 := fixtures.Category(fixtures.CategorySingle)
return c.Render("tests/"+which, fiber.Map{
"TestRole": components.Role(cat1, &fixtures.RoleWithDarkColor, false),
"TestRole2": components.Role(cat1, &fixtures.RoleWithDarkMediumColor, false),
"TestRole3": components.Role(cat1, &fixtures.RoleWithLightColor, true),
"TestRole4": components.Role(cat1, &fixtures.RoleWithDarkColor, false),
"TestRole5": components.Role(cat2, &fixtures.RoleWithLightColor, true),
"TestRole6": components.Role(cat1, &fixtures.RoleWithLightMediumColor, false),
// multi
"Category1": []components.RoleTemplateData{
components.Role(cat1, &fixtures.RoleWithDarkColor, true, true),
components.Role(cat1, &fixtures.RoleWithDarkMediumColor, true, true),
components.Role(cat1, &fixtures.RoleWithLightMediumColor, true, true),
components.Role(cat1, &fixtures.RoleWithLightColor, true, true),
},
// single
"Category2": []components.RoleTemplateData{
components.Role(cat2, &fixtures.RoleWithDarkColor, true, true),
components.Role(cat2, &fixtures.RoleWithDarkMediumColor, true, true),
components.Role(cat2, &fixtures.RoleWithLightMediumColor, true, true),
components.Role(cat2, &fixtures.RoleWithLightColor, true, true),
},
// unsafe
"Category3": []components.RoleTemplateData{
components.Role(cat3, &fixtures.RoleWithDarkColor, true, false),
components.Role(cat3, &fixtures.RoleWithDarkMediumColor, false, false),
components.Role(cat3, &fixtures.RoleWithLightMediumColor, false, false),
components.Role(cat3, &fixtures.RoleWithLightColor, true, false),
},
// unselected
"Category4": []components.RoleTemplateData{
components.Role(cat4, &fixtures.RoleWithDarkColor, true, true),
components.Role(cat4, &fixtures.RoleWithDarkMediumColor, false, true),
components.Role(cat4, &fixtures.RoleWithLightMediumColor, false, true),
components.Role(cat4, &fixtures.RoleWithLightColor, false, true),
},
}, "layouts/main")
}