diff --git a/tests/defhsx.lisp b/tests/defhsx.lisp index a134230..dca1184 100644 --- a/tests/defhsx.lisp +++ b/tests/defhsx.lisp @@ -7,69 +7,68 @@ #:create-element)) (in-package #:hsx-test/defhsx) - (def-suite defhsx-test) (in-suite defhsx-test) (test empty-hsx - (is (equal (macroexpand-1 - '(div)) - '(create-element + (is (equal '(create-element :div - (list))))) + (list)) + (macroexpand-1 + '(div))))) (test hsx-with-props - (is (equal (macroexpand-1 - '(div :prop1 "value1" :prop2 "value2")) - '(create-element + (is (equal '(create-element :div - (list :prop1 "value1" :prop2 "value2"))))) + (list :prop1 "value1" :prop2 "value2")) + (macroexpand-1 + '(div :prop1 "value1" :prop2 "value2"))))) (test hsx-with-children - (is (equal (macroexpand-1 - '(div - "child1" - "child2")) - '(create-element + (is (equal '(create-element :div (list) "child1" - "child2")))) + "child2") + (macroexpand-1 + '(div + "child1" + "child2"))))) (test hsx-with-props-and-children - (is (equal (macroexpand-1 - '(div :prop1 "value1" :prop2 "value2" - "child1" - "child2")) - '(create-element + (is (equal '(create-element :div (list :prop1 "value1" :prop2 "value2") "child1" - "child2")))) + "child2") + (macroexpand-1 + '(div :prop1 "value1" :prop2 "value2" + "child1" + "child2"))))) (deftag custom) (test hsx-for-custom-tag - (is (equal (macroexpand-1 - '(custom :prop1 "value1" :prop2 "value2" - "child1" - "child2")) - '(create-element + (is (equal '(create-element :custom (list :prop1 "value1" :prop2 "value2") "child1" - "child2")))) + "child2") + (macroexpand-1 + '(custom :prop1 "value1" :prop2 "value2" + "child1" + "child2"))))) (defcomp comp (&key prop1 prop2 children) (declare (ignore prop1 prop2 children))) (test hsx-for-component - (is (equal (macroexpand-1 - '(comp :prop1 "value1" :prop2 "value2" - "child1" - "child2")) - '(create-element + (is (equal '(create-element (fdefinition '%comp) (list :prop1 "value1" :prop2 "value2") "child1" - "child2")))) + "child2") + (macroexpand-1 + '(comp :prop1 "value1" :prop2 "value2" + "child1" + "child2"))))) diff --git a/tests/element.lisp b/tests/element.lisp index a58e4c7..9104639 100644 --- a/tests/element.lisp +++ b/tests/element.lisp @@ -4,7 +4,6 @@ #:hsx/element)) (in-package #:hsx-test/element) - (def-suite element-test) (in-suite element-test) @@ -13,9 +12,9 @@ '(:class "red") "Hello," "World"))) - (is (eq (element-type elm) :p)) - (is (equal (element-props elm) '(:class "red"))) - (is (equal (element-children elm) (list "Hello," "World"))))) + (is (eq :p (element-type elm))) + (is (equal '(:class "red") (element-props elm))) + (is (equal (list "Hello," "World") (element-children elm))))) (test flatten-children (let* ((elm (create-element :p @@ -24,7 +23,7 @@ nil (list "b" (list nil "c")) (cons "d" "e")))) - (is (equal (element-children elm) (list "a" "b" "c" "d" "e"))))) + (is (equal (list "a" "b" "c" "d" "e") (element-children elm))))) (defun comp1 (&key title children) (create-element :div @@ -37,11 +36,11 @@ '(:title "foo") "bar")) (expanded (expand-component elm))) - (is (eq (element-type elm) #'comp1)) - (is (equal (element-props elm) '(:title "foo"))) - (is (equal (element-children elm) (list "bar"))) - (is (eq (element-type expanded) :div)) - (is (equal (element-children expanded) (list "foo" "bar"))))) + (is (eq #'comp1 (element-type elm))) + (is (equal '(:title "foo") (element-props elm))) + (is (equal (list "bar") (element-children elm))) + (is (eq :div (element-type expanded))) + (is (equal (list "foo" "bar") (element-children expanded))))) (defun comp2 (&rest props) (create-element :div @@ -54,11 +53,11 @@ '(:title "foo") "bar")) (expanded (expand-component elm))) - (is (eq (element-type elm) #'comp2)) - (is (equal (element-props elm) '(:title "foo"))) - (is (equal (element-children elm) (list "bar"))) - (is (eq (element-type expanded) :div)) - (is (equal (element-children expanded) (list "foo" "bar"))))) + (is (eq #'comp2 (element-type elm))) + (is (equal '(:title "foo") (element-props elm))) + (is (equal (list "bar") (element-children elm))) + (is (eq :div (element-type expanded))) + (is (equal (list "foo" "bar") (element-children expanded))))) (defun comp3 (&rest props &key title children &allow-other-keys) (create-element :div @@ -72,8 +71,8 @@ '(:title "foo" :other-key "baz") "bar")) (expanded (expand-component elm))) - (is (eq (element-type elm) #'comp3)) - (is (equal (element-props elm) '(:title "foo" :other-key "baz"))) - (is (equal (element-children elm) (list "bar"))) - (is (eq (element-type expanded) :div)) - (is (equal (element-children expanded) (list "foo" "bar" "baz"))))) \ No newline at end of file + (is (eq #'comp3 (element-type elm))) + (is (equal '(:title "foo" :other-key "baz") (element-props elm))) + (is (equal (list "bar") (element-children elm))) + (is (eq :div (element-type expanded))) + (is (equal (list "foo" "bar" "baz") (element-children expanded))))) diff --git a/tests/hsx.lisp b/tests/hsx.lisp index e05498f..38ea94d 100644 --- a/tests/hsx.lisp +++ b/tests/hsx.lisp @@ -5,21 +5,20 @@ (:import-from #:hsx/builtin)) (in-package #:hsx-test/hsx) - (def-suite hsx-test) (in-suite hsx-test) (test find-symbols - (is (equal (macroexpand-1 + (is (equal '(hsx/builtin:div + div + (hsx/builtin:div + div + (hsx/builtin:div)) + div) + (macroexpand-1 '(hsx (div div (div div (div)) - div))) - '(hsx/builtin:div - div - (hsx/builtin:div - div - (hsx/builtin:div)) - div)))) + div))))))