summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2023-10-04 14:27:39 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2023-10-04 15:45:25 +0200
commit4c37bf195c00fe0c9f771aa7eadc0b04767f0426 (patch)
tree57fe54e3bb3528369587805b581e30b61dbb5115 /tests
parentec4e08838b8debbe6848d605dc4b7a5f7905d782 (diff)
html: add simple html index implementation
Diffstat (limited to 'tests')
-rw-r--r--tests/html.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/html.scm b/tests/html.scm
new file mode 100644
index 0000000..c5a5967
--- /dev/null
+++ b/tests/html.scm
@@ -0,0 +1,35 @@
+(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
+ (html:css "this.css" #:uri "/this.css")
+ (html:css "that.css" #:uri "/that.css"))
+ #:scripts (list (html:js "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=? 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=\"Este es mi feed\" /><link rel=\"stylesheet\" href=\"/this.css\" /><link rel=\"stylesheet\" href=\"/that.css\" /></head><body><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 src=\"/script.js\" /></body></html>")))
+
+
+(test-end "HTML index page")