hsx/tests/utils.lisp
2024-10-03 10:24:56 +09:00

23 lines
783 B
Common Lisp

(defpackage #:hsx-test/utils
(:use #:cl
#:rove
#:hsx/utils))
(in-package #:hsx-test/utils)
(deftest text-util-test
(testing "escape-html-attribute"
(ok (string= ""foo""
(escape-html-attribute "\"foo\""))))
(testing "escape-html-text-content"
(ok (string= "&<>"'/`="
(escape-html-text-content "&<>\"'/`="))))
(testing "minify"
;; Test with Alpine.js
(ok (string= (minify "{
open: false,
get isOpen() { return this.open },
toggle() { this.open = ! this.open },
}")
"{ open: false, get isOpen() { return this.open }, toggle() { this.open = ! this.open }, }"))))