Simple test of having a render handler that simply renders files by URL name.
This commit is contained in:
parent
0bccddc62c
commit
db58b38917
4 changed files with 19 additions and 13 deletions
7
main.go
7
main.go
|
|
@ -29,9 +29,12 @@ func main() {
|
||||||
store := session.New()
|
store := session.New()
|
||||||
|
|
||||||
engine := html.New("./views", ".html")
|
engine := html.New("./views", ".html")
|
||||||
|
|
||||||
app := fiber.New(fiber.Config{
|
app := fiber.New(fiber.Config{
|
||||||
Views: engine,
|
Views: engine,
|
||||||
|
ViewsLayout: "layouts/main",
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Use(logger.New())
|
app.Use(logger.New())
|
||||||
app.Use(recov.New())
|
app.Use(recov.New())
|
||||||
|
|
||||||
|
|
@ -91,8 +94,8 @@ func main() {
|
||||||
|
|
||||||
app.Static("/", "./public")
|
app.Static("/", "./public")
|
||||||
|
|
||||||
app.Get("/test/", func (c *fiber.Ctx) error {
|
app.Get("/test/:name/", func (c *fiber.Ctx) error {
|
||||||
return c.Render("index", fiber.Map{
|
return c.Render(c.Params("name"), fiber.Map{
|
||||||
"Title": "Hello, World!",
|
"Title": "Hello, World!",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
<title>ZedShaw's Game Thing</title>
|
<title>ZedShaw's Game Thing</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
<body data-testid="home-page">
|
<body data-testid="home-page">
|
||||||
<header>
|
<header>
|
||||||
<a href="/">🏡</a> <span>Zed's Game Dev Website Yay</span>
|
<a href="/">🏡</a> <span>Zed's Game Dev Website Yay</span>
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@ func TestLogin(t *testing.T) {
|
||||||
ctx, cancel := Setup(5); defer cancel()
|
ctx, cancel := Setup(5); defer cancel()
|
||||||
|
|
||||||
Run(assert, ctx,
|
Run(assert, ctx,
|
||||||
browser.Navigate(`http://127.0.0.1:5002/login/`),
|
browser.Navigate(`http://127.0.0.1:5002/login/`),
|
||||||
browser.WaitVisible(`body > footer`),
|
browser.WaitVisible(`body > footer`),
|
||||||
browser.WaitVisible(`[data-testid="login-page"]`),
|
browser.WaitVisible(`[data-testid="login-page"]`),
|
||||||
browser.SendKeys(`#username`, `zedshaw`),
|
browser.SendKeys(`#username`, `zedshaw`),
|
||||||
browser.SendKeys(`#password`, `1234`),
|
browser.SendKeys(`#password`, `1234`),
|
||||||
browser.Click(`#login-submit`, browser.NodeVisible),
|
browser.Click(`#login-submit`, browser.NodeVisible),
|
||||||
browser.WaitVisible(`body > footer`),
|
browser.WaitVisible(`body > footer`),
|
||||||
browser.WaitVisible(`[data-testid="home-page"]`))
|
browser.WaitVisible(`[data-testid="home-page"]`))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStreamPage(t *testing.T) {
|
func TestStreamPage(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Main</title>
|
<meta charset="utf-8" />
|
||||||
|
<link rel="stylesheet" href="/global.css">
|
||||||
|
<link rel="stylesheet" href="/color.css">
|
||||||
|
<link rel="stylesheet" href="/blockstart.css">
|
||||||
|
<title>{{.Title}}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue