(defpackage #:hsx-test/renderer (:use #:cl #:fiveam #:named-readtables #:hsx/builtin) (:import-from #:mstrings) (:import-from #:hsx/element #:render-to-string)) (in-package :hsx-test/renderer) (in-readtable mstrings:mstring-syntax) (def-suite renderer-test) (in-suite renderer-test) (test empty-tag (is (string= "
" (render-to-string (div))))) (test tag-with-props (is (string= "" (render-to-string (div :prop1 "value1" :prop2 t :prop3 nil))))) (test tag-with-children (is (string= "foo
" (render-to-string (p "foo") :pretty t))) (is (string= #M"\ foo \
" (render-to-string (p (span "foo")) :pretty t))) (is (string= #M"\ foo \ bar \
" (render-to-string (p "foo" (span "bar")) :pretty t)))) (test tag-with-props-and-children (is (string= "foo
" (render-to-string (p :prop1 "value1" :prop2 t :prop3 nil "foo") :pretty t))) (is (string= #M"\ foo \ bar \
" (render-to-string (p :prop1 "value1" :prop2 t :prop3 nil "foo" (span "bar")) :pretty t)))) (test self-closing-tag (is (string= "" (render-to-string (img :src "/background.png") :pretty t)))) (test escaping-tag (is (string= #M"