File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 :value value
6767 :checked checked?}]))
6868
69+ (defn radio-button
70+ " Creates a radio button."
71+ ([name]
72+ (radio-button name (*params* name)))
73+ ([name checked?]
74+ (radio-button name checked? " true" ))
75+ ([name checked? value]
76+ [:input {:type " radio"
77+ :name (str* name)
78+ :id (str* name)
79+ :value value
80+ :checked checked?}]))
81+
6982(defn select-options
7083 " Turn a collection into a set of option tags."
7184 ([options]
Original file line number Diff line number Diff line change 3131 :value " true"
3232 :checked nil }])))
3333
34+ (deftest test-radio-button
35+ (is (= (radio-button :foo )
36+ [:input {:type " radio"
37+ :id " foo"
38+ :name " foo"
39+ :value " true"
40+ :checked nil }])))
41+
42+ (deftest test-radio-button-selected
43+ (is (= (radio-button :foo true " abcdef" )
44+ [:input {:type " radio"
45+ :id " foo"
46+ :name " foo"
47+ :value " abcdef"
48+ :checked true }])))
49+
3450(deftest select-options-with-values
3551 (is (= (select-options [[" a" " 1" ] [" b" " 2" ] [" c" " 3" ]])
3652 '([:option {:value " 1" } " a" ]
You can’t perform that action at this time.
0 commit comments