Init
This commit is contained in:
20
tests/test_rendering.nim
Executable file
20
tests/test_rendering.nim
Executable file
@@ -0,0 +1,20 @@
|
||||
import std/[os, strutils, unittest]
|
||||
import luxtools
|
||||
|
||||
const indexTemplate = staticRead("../templates/index.html")
|
||||
|
||||
suite "rendering helpers":
|
||||
test "counter markup references hx attributes":
|
||||
let html = renderCounter(3)
|
||||
check html.contains("hx-post=\"/counter\"")
|
||||
check html.contains("id=\"counter\"")
|
||||
check html.contains("3")
|
||||
|
||||
test "index template uses vendored htmx build":
|
||||
check indexTemplate.contains("/lib/htmx.2.0.7.min.js")
|
||||
check indexTemplate.contains("<script src=\"/lib/htmx.2.0.7.min.js\" defer></script>")
|
||||
check not indexTemplate.contains("unpkg.com/htmx")
|
||||
|
||||
test "vendored htmx asset lives in assets directory":
|
||||
let assetPath = joinPath(getAppDir(), "..", "assets", "lib", "htmx.2.0.7.min.js")
|
||||
check fileExists(assetPath)
|
||||
Reference in New Issue
Block a user