Test and create form controls using columns
This commit is contained in:
parent
3290cfc1e9
commit
3c4e995641
2 changed files with 14 additions and 5 deletions
|
@ -38,12 +38,10 @@
|
||||||
:class "col-form-label"
|
:class "col-form-label"
|
||||||
,label))
|
,label))
|
||||||
(:div :class "col-auto"
|
(:div :class "col-auto"
|
||||||
(:label :type ,type
|
(:input :class "form-control"
|
||||||
|
:type ,type
|
||||||
:id ,id
|
:id ,id
|
||||||
:class "form-control"))
|
:placeholder ,placeholder)))))))
|
||||||
(:div :class "col-auto"
|
|
||||||
(:span :class "form-text"
|
|
||||||
,text)))))))
|
|
||||||
|
|
||||||
(defmacro select-option (&rest rest)
|
(defmacro select-option (&rest rest)
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
(:import-from
|
(:import-from
|
||||||
:cl-sbt/form
|
:cl-sbt/form
|
||||||
:ctrl
|
:ctrl
|
||||||
|
:ctrl-col
|
||||||
:select
|
:select
|
||||||
:select-option))
|
:select-option))
|
||||||
|
|
||||||
|
@ -83,3 +84,13 @@
|
||||||
(ok (search "class=form-select" result))
|
(ok (search "class=form-select" result))
|
||||||
(ok (search "size=3" result))
|
(ok (search "size=3" result))
|
||||||
(ok (search "option value=1" result)))))
|
(ok (search "option value=1" result)))))
|
||||||
|
|
||||||
|
(deftest test-simple-form-control-cols
|
||||||
|
(let ((result (spinneret:with-html-string (ctrl-col (:id "exampleFormControlInput1" :label "Email address" :type "email" :placeholder "name@example.com")))))
|
||||||
|
(testing "Generates correct HTML for a simple form using cols"
|
||||||
|
(ok (search "for=exampleFormControlInput1" result))
|
||||||
|
(ok (search "class=col-form-label" result))
|
||||||
|
(ok (search "type=email" result))
|
||||||
|
(ok (search "class=form-control" result))
|
||||||
|
(ok (search "id=exampleFormControlInput1" result))
|
||||||
|
(ok (search "placeholder=name@example.com" result)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue