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

Hello, World!

" (render (hsx (p "Hello, World!"))))) (is (string= #M"

\ Hello, \ World! \

" (render (hsx (p "Hello," (span "World!"))))))) (test tag-with-props-and-children (is (string= "

Hello, World!

" (render (hsx (p :prop1 "value1" :prop2 t :prop3 nil "Hello, World!"))))) (is (string= #M"

\ Hello, \ World! \

" (render (hsx (p :prop1 "value1" :prop2 t :prop3 nil "Hello," (span "World!"))))))) (test fragment (let ((frg (hsx (<> (li "bar") (li "baz"))))) (is (string= #M"
  • bar
  • baz
  • " (render frg))) (is (string= #M"" (render (hsx (ul (li "foo") frg (li "brah")))))))) ;; TODO: Add escaping test