Minify props string

This commit is contained in:
Akira Tempaku 2024-10-03 09:54:43 +09:00
parent 6f8df3e00d
commit b430b42699
5 changed files with 61 additions and 33 deletions

View file

@ -1,14 +0,0 @@
(defpackage #:hsx-test/escaper
(:use #:cl
#:rove
#:hsx/escaper))
(in-package #:hsx-test/escaper)
(deftest escaper-test
(testing "escape-html-attribute"
(ok (string= ""foo""
(escape-html-attribute "\"foo\""))))
(testing "escape-html-text-content"
(ok (string= "&<>"'/`="
(escape-html-text-content "&<>\"'/`=")))))

23
tests/utils.lisp Normal file
View file

@ -0,0 +1,23 @@
(defpackage #:hsx-test/utils
(:use #:cl
#:rove
#:hsx/utils))
(in-package #:hsx-test/utils)
(deftest text-util-test
(testing "escape-html-attribute"
(ok (string= "&quot;foo&quot;"
(escape-html-attribute "\"foo\""))))
(testing "escape-html-text-content"
(ok (string= "&amp;&lt;&gt;&quot;&#x27;&#x2F;&grave;&#x3D;"
(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 }, }"))))