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

View file

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

View file

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