blob: 805ab173209177fe85827a9d874bdf631dd24b1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
(define-module (tests html)
#:use-module (src dates)
#:use-module (srfi srfi-64)
#:use-module ((src html) #:prefix html:))
(test-begin "HTML index page")
(define me (html:person "Ekaitz"
#:email "ekaitz@elenq.tech"
#:uri "https://elenq.tech"))
(define index
(html:index #:title "Mi feed"
#:description "Este es mi feed"
#:uri "https://feed.elenq.tech/index.html"
#:styles (list
"body {color: grey}"
(html:media "that.css" #:uri "/that.css"))
#:scripts (list
"console.log(\"HOLA\")"
(html:media "script.js" #:uri "/script.js"))
#:author me
#:posts (list
(html:post #:title "first entry"
#:published (string/ISO->date "2023-03-01")
#:authors (list me)
#:summary-html '(p "Este es el resumen")
#:content-html '(p "Este es el contenido")
#:categories (list "una" "dos" "tres")
#:media (list)))))
(let ((html-index (with-output-to-string (lambda () (html:render index)))))
(test-assert (string=? (pk html-index)
"<!DOCTYPE html><html><head><meta author=\"Ekaitz\" /><meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><meta name=\"description\" content=\"\" /><style>body {color: grey}</style><link rel=\"stylesheet\" href=\"/that.css\" /></head><body><h1 class=\"title\">Mi feed</h1><section class=\"description\"></section><article class=\"post\" id=\"first-entry\"><h2>first entry</h2><time datetime=\"2023-03-01T00:00:00+0100\" pubdate=\"#t\">2023-03-01T00:00:00+0100</time><address class=\"author\"><a rel=\"author\">Ekaitz</a></address><section class=\"summary\"><p>Este es el resumen</p></section><section class=\"content\"><p>Este es el contenido</p></section></article><script>console.log(\"HOLA\")</script><script src=\"/script.js\" /></body></html>")))
(test-end "HTML index page")
|