(defpackage #:hsx-test/renderer (:use #:cl #:fiveam #:named-readtables #:hsx/builtin) (:import-from #:mstrings) (:import-from #:hsx/element #:render)) (in-package :hsx-test/renderer) (in-readtable mstrings:mstring-syntax) (def-suite renderer-test) (in-suite renderer-test) (test empty-tag (is (string= "
" (render (div))))) (test tag-with-props (is (string= "
" (render (div :prop1 "value1" :prop2 t :prop3 nil))))) (test tag-with-children (is (string= "

foo

" (render (p "foo")))) (is (string= #M"

\ foo \

" (render (p (span "foo"))))) (is (string= #M"

\ foo \ bar \

" (render (p "foo" (span "bar")))))) (test tag-with-props-and-children (is (string= "

foo

" (render (p :prop1 "value1" :prop2 t :prop3 nil "foo")))) (is (string= #M"

\ foo \ bar \

" (render (p :prop1 "value1" :prop2 t :prop3 nil "foo" (span "bar")))))) (test self-closing-tag (is (string= "" (render (img :src "/background.png"))))) (test fragment (let ((frg (<> (li "bar") (li "baz")))) (is (string= #M"
  • bar
  • baz
  • " (render frg))) (is (string= #M"" (render (ul (li "foo") frg (li "brah")))))))