This commit is contained in:
paku 2024-05-26 21:45:49 +09:00
parent 6c6dce401e
commit c24da9a7e9
3 changed files with 8 additions and 8 deletions

View file

@ -25,7 +25,7 @@
(multiple-value-bind (props children)
(parse-body body)
`(create-element ,',(string-downcase name)
',props
(list ,@props)
,@children))))
(defparameter *builtin-elements* (make-hash-table))
@ -58,7 +58,7 @@
(multiple-value-bind (props children)
(parse-body body)
`(create-element #',',%name
',props
(list ,@props)
,@children))))))
(defun builtin-element-p (node)

View file

@ -3,7 +3,7 @@
#:fiveam)
(:import-from #:hsx/element
#:element-type
#:element-props)
#:element-children)
(:import-from #:hsx/hsx
#:hsx
#:defcomp))

View file

@ -13,14 +13,14 @@
'(div))
'(create-element
"div"
'nil))))
(list)))))
(test hsx-with-props
(is (equal (macroexpand-1
'(div :prop1 "value1" :prop2 "value2"))
'(create-element
"div"
'(:prop1 "value1" :prop2 "value2")))))
(list :prop1 "value1" :prop2 "value2")))))
(test hsx-with-children
(is (equal (macroexpand-1
@ -29,7 +29,7 @@
"child2"))
'(create-element
"div"
'nil
(list)
"child1"
"child2"))))
@ -40,7 +40,7 @@
"child2"))
'(create-element
"div"
'(:prop1 "value1" :prop2 "value2")
(list :prop1 "value1" :prop2 "value2")
"child1"
"child2"))))
@ -54,6 +54,6 @@
"child2"))
'(create-element
#'%comp
'(:prop1 "value1" :prop2 "value2")
(list :prop1 "value1" :prop2 "value2")
"child1"
"child2"))))