Integrate defhsx package into hsx package
This commit is contained in:
parent
97139dca49
commit
693e6704f9
8 changed files with 98 additions and 108 deletions
|
@ -1,52 +0,0 @@
|
|||
(defpackage #:hsx-test/defhsx
|
||||
(:use #:cl
|
||||
#:fiveam
|
||||
#:hsx/defhsx
|
||||
#:hsx/builtin)
|
||||
(:import-from #:hsx/element
|
||||
#:element-props
|
||||
#:element-children))
|
||||
(in-package #:hsx-test/defhsx)
|
||||
|
||||
(def-suite defhsx-test)
|
||||
(in-suite defhsx-test)
|
||||
|
||||
(test empty-hsx
|
||||
(let ((elm (div)))
|
||||
(is (null (element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-static-props
|
||||
(let ((elm (div :prop1 "value1" :prop2 "value2")))
|
||||
(is (equal '(:prop1 "value1" :prop2 "value2")
|
||||
(element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-dynamic-props
|
||||
(let* ((props '(:prop1 "value1" :prop2 "value2"))
|
||||
(elm (div props)))
|
||||
(is (equal props (element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-children
|
||||
(let ((elm (div
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (null (element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
||||
|
||||
(test hsx-with-static-props-and-children
|
||||
(let ((elm (div :prop1 "value1" :prop2 "value2"
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (equal '(:prop1 "value1" :prop2 "value2")
|
||||
(element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
||||
|
||||
(test hsx-with-dynamic-props-and-children
|
||||
(let* ((props '(:prop1 "value1" :prop2 "value2"))
|
||||
(elm (div props
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (equal props (element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
|
@ -1,6 +1,6 @@
|
|||
(defpackage #:hsx-test/element
|
||||
(:use #:cl
|
||||
#:fiveam
|
||||
#:fiveam
|
||||
#:hsx/element)
|
||||
(:import-from #:named-readtables
|
||||
#:in-readtable)
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
(defpackage #:hsx-test/hsx
|
||||
(:use #:cl
|
||||
#:fiveam
|
||||
#:hsx/hsx))
|
||||
#:hsx/hsx
|
||||
#:hsx/builtin)
|
||||
(:import-from #:hsx/element
|
||||
#:element-props
|
||||
#:element-children))
|
||||
(in-package #:hsx-test/hsx)
|
||||
|
||||
(def-suite hsx-test)
|
||||
|
@ -23,3 +27,43 @@
|
|||
(div)
|
||||
:div)
|
||||
"div"))))))
|
||||
|
||||
(test empty-hsx
|
||||
(let ((elm (div)))
|
||||
(is (null (element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-static-props
|
||||
(let ((elm (div :prop1 "value1" :prop2 "value2")))
|
||||
(is (equal '(:prop1 "value1" :prop2 "value2")
|
||||
(element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-dynamic-props
|
||||
(let* ((props '(:prop1 "value1" :prop2 "value2"))
|
||||
(elm (div props)))
|
||||
(is (equal props (element-props elm)))
|
||||
(is (null (element-children elm)))))
|
||||
|
||||
(test hsx-with-children
|
||||
(let ((elm (div
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (null (element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
||||
|
||||
(test hsx-with-static-props-and-children
|
||||
(let ((elm (div :prop1 "value1" :prop2 "value2"
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (equal '(:prop1 "value1" :prop2 "value2")
|
||||
(element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
||||
|
||||
(test hsx-with-dynamic-props-and-children
|
||||
(let* ((props '(:prop1 "value1" :prop2 "value2"))
|
||||
(elm (div props
|
||||
"child1"
|
||||
"child2")))
|
||||
(is (equal props (element-props elm)))
|
||||
(is (equal (list "child1" "child2") (element-children elm)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue