Add hsx/hsx package

This commit is contained in:
Akira Tempaku 2024-05-26 01:26:26 +09:00
parent 3eea6a4e39
commit 803b9add14
5 changed files with 96 additions and 1 deletions

32
tests/hsx.lisp Normal file
View file

@ -0,0 +1,32 @@
(defpackage #:hsx-test/hsx
(:use #:cl
#:fiveam
#:hsx/element
#:hsx/hsx))
(in-package #:hsx-test/hsx)
(def-suite builtin-element-hsx)
(def-suite component-element-hsx)
(in-suite builtin-element-hsx)
(test empty-hsx
(let ((elm (div)))
(is (null (element-props elm)))
(is (null (element-children elm)))))
(test hsx-with-props
(let ((elm (div :prop1 "value1" :prop2 "value2")))
(is (equal (element-props elm) '(:prop1 "value1" :prop2 "value2")))
(is (null (element-children elm)))))
(test hsx-with-children
(let ((elm (div "child1" "child2")))
(is (null (element-props elm)))
(is (equal (element-children elm) (list "child1" "child2")))))
(test hsx-with-props-and-children
(test hsx-with-props
(let ((elm (div :prop1 "value1" :prop2 "value2"
"child1" "child2")))
(is (equal (element-props elm) '(:prop1 "value1" :prop2 "value2")))
(is (equal (element-children elm) (list "child1" "child2"))))))