This commit is contained in:
2025-10-01 12:07:25 +02:00
commit 34127035c5
9 changed files with 341 additions and 0 deletions

20
tests/test_rendering.nim Executable file
View 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)