Add questionnaire tests
This commit is contained in:
parent
075944afcd
commit
ad9e376f15
3 changed files with 32 additions and 2 deletions
|
@ -55,6 +55,7 @@
|
||||||
(:file "list-group")
|
(:file "list-group")
|
||||||
(:file "navbar")
|
(:file "navbar")
|
||||||
(:file "nav-tab")
|
(:file "nav-tab")
|
||||||
(:file "form"))))
|
(:file "form")
|
||||||
|
(:file "questionnaire"))))
|
||||||
:description "Test system for cl-sbt"
|
:description "Test system for cl-sbt"
|
||||||
:perform (test-op (op c) (symbol-call :rove :run c)))
|
:perform (test-op (op c) (symbol-call :rove :run c)))
|
||||||
|
|
|
@ -123,5 +123,4 @@ Example:
|
||||||
`(question ,ask
|
`(question ,ask
|
||||||
(:group ,group :type ,input-type)
|
(:group ,group :type ,input-type)
|
||||||
,@remaining-choices)))))
|
,@remaining-choices)))))
|
||||||
|
|
||||||
(btn-primary (:type "submit") "Submit"))))
|
(btn-primary (:type "submit") "Submit"))))
|
||||||
|
|
30
tests/component/questionnaire.lisp
Normal file
30
tests/component/questionnaire.lisp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
(defpackage cl-sbt/tests/questionnaire
|
||||||
|
(:use
|
||||||
|
:cl
|
||||||
|
:cl-sbt
|
||||||
|
:rove)
|
||||||
|
(:import-from
|
||||||
|
:cl-sbt/questionnaire
|
||||||
|
:question
|
||||||
|
:resolve-input-type
|
||||||
|
:resolve-input-and-choices
|
||||||
|
:questionnaire))
|
||||||
|
|
||||||
|
(in-package :cl-sbt/tests/questionnaire)
|
||||||
|
|
||||||
|
(deftest test-resolve-input-type
|
||||||
|
(testing "Test for resolve-input-type"
|
||||||
|
(ok (string= "radio" (resolve-input-type "single")))
|
||||||
|
(ok (string= "checkbox" (resolve-input-type "multiple")))
|
||||||
|
(ok (string= "text" (resolve-input-type "text")))))
|
||||||
|
|
||||||
|
(deftest test-resolve-input-and-choices
|
||||||
|
(testing "Test for resolve-input-and-choices"
|
||||||
|
(multiple-value-bind (type choices)
|
||||||
|
(resolve-input-and-choices '(:radio "A" "B"))
|
||||||
|
(ok (string= type "radio"))
|
||||||
|
(ok (equal choices '("A" "B"))))
|
||||||
|
(multiple-value-bind (type choices)
|
||||||
|
(resolve-input-and-choices '("A" "B"))
|
||||||
|
(ok (null type))
|
||||||
|
(ok (equal choices '("A" "B"))))))
|
Loading…
Add table
Reference in a new issue