Improve hsx-test/hsx

This commit is contained in:
paku 2024-05-28 16:13:41 +09:00
parent ead5c408e3
commit 6daffb4ddf

View file

@ -2,11 +2,6 @@
(:use #:cl (:use #:cl
#:fiveam #:fiveam
#:hsx/hsx) #:hsx/hsx)
(:import-from #:hsx/element
#:element-type
#:element-children)
(:import-from #:hsx/defhsx
#:defcomp)
(:import-from #:hsx/builtin)) (:import-from #:hsx/builtin))
(in-package #:hsx-test/hsx) (in-package #:hsx-test/hsx)
@ -14,20 +9,17 @@
(def-suite hsx-test) (def-suite hsx-test)
(in-suite hsx-test) (in-suite hsx-test)
(defcomp div (&rest props)
(declare (ignore props))
"This is fake!")
(defcomp p (&rest props)
(declare (ignore props))
"This is fake!")
(test find-symbols (test find-symbols
(let ((fake-elm (div :prop "value" (is (equal (macroexpand-1
(p "brah")))) '(hsx (div
(is (eql (element-type fake-elm) #'%div) div
(eql (element-type (first (element-children fake-elm))) #'%p))) (div
(let ((true-elm (hsx (div :prop "value" div
(p "brah"))))) (div))
(is (equal (element-type true-elm) "div") div)))
(equal (element-type (first (element-children true-elm))) "p")))) '(hsx/builtin:div
div
(hsx/builtin:div
div
(hsx/builtin:div))
div))))