Add test to questionnaire for mixed choices

This commit is contained in:
Marcus Kammer 2023-09-04 15:48:47 +02:00
parent 4d8cce56b5
commit fadd2678cf

View file

@ -54,3 +54,18 @@
(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)))))
(deftest test-create-questionnaire-mixed-choices
(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"
:text "Others (please specify)"))))))
(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 "<label>Others (please specify) <input type=text name=group-device>" result))
(ok (search "<hr class=my-4>" result))
(ok (search "<button class=\"btn btn-primary\" type=submit>Submit</button>" result)))))