Update tests for questionnaire
This commit is contained in:
parent
fd47c29f8a
commit
4d8cce56b5
1 changed files with 16 additions and 7 deletions
|
@ -29,19 +29,28 @@
|
|||
(ok (null type))
|
||||
(ok (equal choices '("A" "B"))))))
|
||||
|
||||
(deftest test-create-questionnaire
|
||||
(deftest test-create-questionnaire-single
|
||||
(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"
|
||||
(testing "Generates correct HTML for questionnaire with single choices"
|
||||
(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 "<legend>Your Gender?</legend>" 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)))))
|
||||
|
||||
(deftest test-create-questionnaire-multiple
|
||||
(let ((result (spinneret:with-html-string
|
||||
(questionnaire "/submit"
|
||||
(:ask "Which of the following devices do you regularly use to browse the internet?"
|
||||
:group "device"
|
||||
:choices (:multiple "Desktop" "Laptop" "Tablet"))))))
|
||||
(testing "Generates correct HTML for questionnaire with multiple choices"
|
||||
(ok (search "<form class=py-5 action=/submit method=post>" result))
|
||||
(ok (search "<legend>Which of the following devices do you regularly use to browse the internet?</legend>" result))
|
||||
(ok (search "<input type=checkbox name=group-device value=Desktop> Desktop</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