fix set user element attr/children test
This commit is contained in:
parent
24ace4da05
commit
c5a1de8b23
2 changed files with 14 additions and 11 deletions
|
@ -133,15 +133,17 @@ When given :ASCII and :ATTR, it's possible to insert html text as a children, e.
|
||||||
`(defun ,name (&rest ,g!attrs-and-children)
|
`(defun ,name (&rest ,g!attrs-and-children)
|
||||||
(multiple-value-bind (,g!attrs ,g!children)
|
(multiple-value-bind (,g!attrs ,g!children)
|
||||||
(split-attrs-and-children ,g!attrs-and-children)
|
(split-attrs-and-children ,g!attrs-and-children)
|
||||||
(let ,(mapcar (lambda (arg)
|
(let ((,g!element
|
||||||
(list arg `(cdr (assoc (make-keyword ',arg) (attrs-alist ,g!attrs)))))
|
(make-user-element :tag (string-downcase ',name) :attrs ,g!attrs
|
||||||
args)
|
:children ,g!children)))
|
||||||
(make-user-element :tag (string-downcase ',name) :attrs ,g!attrs
|
(setf (user-element-expander ,g!element)
|
||||||
:children ,g!children
|
(lambda (tag attrs children)
|
||||||
:expander
|
(declare (ignorable tag attrs children))
|
||||||
(lambda (tag attrs children)
|
(let ,(mapcar (lambda (arg)
|
||||||
(declare (ignorable tag attrs children))
|
(list arg `(attr attrs (make-keyword ',arg))))
|
||||||
(progn ,@body)))))))
|
args)
|
||||||
|
(progn ,@body))))
|
||||||
|
,g!element))))
|
||||||
|
|
||||||
(defvar *expand-user-element* t)
|
(defvar *expand-user-element* t)
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,8 @@
|
||||||
(is (string= "woo" (second (element-children dog4))))
|
(is (string= "woo" (second (element-children dog4))))
|
||||||
|
|
||||||
(setf (attr dog4 :size) 16)
|
(setf (attr dog4 :size) 16)
|
||||||
(is (= 16 (attr dog4 :size)))
|
(is (string= "big-dog" (attr (user-element-expand-to dog4) :class)))
|
||||||
(is (string= "big-dog" (attr (user-element-expand-to dog4) :class)))))
|
(setf (element-children dog4) (list dog1 dog2 dog3))
|
||||||
|
(is (equal (list dog1 dog2 dog3 "dog") (element-children (user-element-expand-to dog4))))))
|
||||||
|
|
||||||
(run-all-tests)
|
(run-all-tests)
|
||||||
|
|
Loading…
Reference in a new issue