1 IN: html.components.tests
2 USING: tools.test kernel io.streams.string
3 io.streams.null accessors inspector html.streams
4 html.elements html.components html.forms namespaces ;
6 [ ] [ begin-form ] unit-test
8 [ ] [ 3 "hi" set-value ] unit-test
10 [ 3 ] [ "hi" value ] unit-test
12 TUPLE: color red green blue ;
14 [ ] [ 1 2 3 color boa from-object ] unit-test
16 [ 1 ] [ "red" value ] unit-test
18 [ ] [ "jimmy" "red" set-value ] unit-test
26 [ ] [ "<jimmy>" "red" set-value ] unit-test
34 [ "<input value=\"<jimmy>\" name=\"red\" type=\"hidden\"/>" ] [
40 [ ] [ "'jimmy'" "red" set-value ] unit-test
42 [ "<input value=\"'jimmy'\" name=\"red\" size=\"5\" type=\"text\"/>" ] [
44 "red" <field> 5 >>size render
48 [ "<input value=\"\" name=\"red\" size=\"5\" type=\"password\"/>" ] [
50 "red" <password> 5 >>size render
56 "green" <textarea> render
62 "green" <textarea> 25 >>rows 30 >>cols render
66 [ ] [ begin-form ] unit-test
68 [ ] [ "new york" "city1" set-value ] unit-test
70 [ ] [ { "new york" "los angeles" "chicago" } "cities" set-value ] unit-test
81 [ ] [ { "los angeles" "new york" } "city2" set-value ] unit-test
104 [ ] [ begin-form ] unit-test
106 [ ] [ t "delivery" set-value ] unit-test
108 [ "<input type=\"checkbox\" checked=\"true\" name=\"delivery\">Delivery</input>" ] [
117 [ ] [ f "delivery" set-value ] unit-test
119 [ "<input type=\"checkbox\" name=\"delivery\">Delivery</input>" ] [
130 M: link-test link-title drop "<Link Title>" ;
132 M: link-test link-href drop "http://www.apple.com/foo&bar" ;
134 [ ] [ link-test "link" set-value ] unit-test
136 [ "<a href=\"http://www.apple.com/foo&bar\"><Link Title></a>" ] [
137 [ "link" link new render ] with-string-writer
141 "<html>arbitrary <b>markup</b> for the win!</html>" "html" set-value
144 [ "<html>arbitrary <b>markup</b> for the win!</html>" ] [
145 [ "html" html render ] with-string-writer
148 [ ] [ "int x = 4;" "code" set-value ] unit-test
150 [ ] [ "java" "mode" set-value ] unit-test
152 [ "<span class=\"KEYWORD3\">int</span> x <span class=\"OPERATOR\">=</span> <span class=\"DIGIT\">4</span>;" ] [
153 [ "code" <code> "mode" >>mode render ] with-string-writer
156 [ ] [ "-foo\n-bar" "farkup" set-value ] unit-test
158 [ "<ul><li>foo</li>\n<li>bar</li></ul>" ] [
159 [ "farkup" T{ farkup } render ] with-string-writer
162 [ ] [ { 1 2 3 } "object" set-value ] unit-test
165 [ "object" inspector render ] with-string-writer
166 USING: splitting sequences ;
167 "\"" split "'" join ! replace " with ' for now
168 [ "object" value [ describe ] with-html-writer ] with-string-writer
172 [ ] [ begin-form ] unit-test
176 "concatenative" "model" set-value
184 T{ form f V{ } H{ { "model" "concatenative" } } }
187 ] [ values ] unit-test