Add test for questionnaire
This commit is contained in:
parent
faa4d153f7
commit
fd47c29f8a
1 changed files with 17 additions and 0 deletions
|
@ -28,3 +28,20 @@
|
||||||
(resolve-input-and-choices '("A" "B"))
|
(resolve-input-and-choices '("A" "B"))
|
||||||
(ok (null type))
|
(ok (null type))
|
||||||
(ok (equal choices '("A" "B"))))))
|
(ok (equal choices '("A" "B"))))))
|
||||||
|
|
||||||
|
(deftest test-create-questionnaire
|
||||||
|
(let ((result (spinneret:with-html-string
|
||||||
|
(questionnaire "/submit"
|
||||||
|
(:ask "How old are you?"
|
||||||
|
:group "age"
|
||||||
|
:choices (:single "18-24" "25-34" "35-44" "45-54" "55+"))
|
||||||
|
(:ask "Your Gender?"
|
||||||
|
:group "gender"
|
||||||
|
:choices (:single "Male" "Female" "Non-Binary" "Prefer not to say"))))))
|
||||||
|
(testing "Generates correct HTML for questionnaire"
|
||||||
|
(ok (search "<form class=py-5 action=/submit method=post>" result))
|
||||||
|
(ok (search "<legend>How old are you?</legend>" result))
|
||||||
|
(ok (search "<input type=radio name=group-age value=18_24> 18-24</label>" result))
|
||||||
|
(ok (search "<input type=radio name=group-gender value=Male> Male</label>" result))
|
||||||
|
(ok (search "<hr class=my-4>" result))
|
||||||
|
(ok (search "<button class=\"btn btn-primary\" type=submit>Submit</button>" result)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue