golf 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. data/golf.gemspec +1 -1
  2. data/lib/golf/version.rb +1 -1
  3. metadata +1 -121
  4. data/golf-java/README.markdown +0 -41
  5. data/golf-java/THANKS.markdown +0 -14
  6. data/golf-java/build/classes.zip +0 -0
  7. data/golf-java/build/com/thinkminimo/golf/GolfResource$MimeMapping$MimeMappingSingleton.class +0 -0
  8. data/golf-java/build/com/thinkminimo/golf/GolfResource$MimeMapping.class +0 -0
  9. data/golf-java/build/com/thinkminimo/golf/GolfResource.class +0 -0
  10. data/golf-java/build/com/thinkminimo/golf/GolfServlet$1.class +0 -0
  11. data/golf-java/build/com/thinkminimo/golf/GolfServlet$GolfContext.class +0 -0
  12. data/golf-java/build/com/thinkminimo/golf/GolfServlet$GolfParams.class +0 -0
  13. data/golf-java/build/com/thinkminimo/golf/GolfServlet$GolfSession.class +0 -0
  14. data/golf-java/build/com/thinkminimo/golf/GolfServlet$PermanentRedirectException.class +0 -0
  15. data/golf-java/build/com/thinkminimo/golf/GolfServlet$RedirectException.class +0 -0
  16. data/golf-java/build/com/thinkminimo/golf/GolfServlet$StoredJSVM.class +0 -0
  17. data/golf-java/build/com/thinkminimo/golf/GolfServlet.class +0 -0
  18. data/golf-java/build/com/thinkminimo/golf/JsonpTunnel.class +0 -0
  19. data/golf-java/build/com/thinkminimo/golf/Main$1.class +0 -0
  20. data/golf-java/build/com/thinkminimo/golf/Main$RingList.class +0 -0
  21. data/golf-java/build/com/thinkminimo/golf/Main.class +0 -0
  22. data/golf-java/build/com/thinkminimo/golf/ProxyServlet.class +0 -0
  23. data/golf-java/build/com/yahoo/platform/yui/compressor/CssCompressor.class +0 -0
  24. data/golf-java/build/com/yahoo/platform/yui/compressor/JarClassLoader.class +0 -0
  25. data/golf-java/build/com/yahoo/platform/yui/compressor/JavaScriptCompressor.class +0 -0
  26. data/golf-java/build/com/yahoo/platform/yui/compressor/JavaScriptIdentifier.class +0 -0
  27. data/golf-java/build/com/yahoo/platform/yui/compressor/JavaScriptToken.class +0 -0
  28. data/golf-java/build/com/yahoo/platform/yui/compressor/ScriptOrFnScope.class +0 -0
  29. data/golf-java/build/depends.zip +0 -0
  30. data/golf-java/build/golf +0 -2
  31. data/golf-java/build/org/json/JSONArray.class +0 -0
  32. data/golf-java/build/org/json/JSONException.class +0 -0
  33. data/golf-java/build/org/json/JSONObject$1.class +0 -0
  34. data/golf-java/build/org/json/JSONObject$Null.class +0 -0
  35. data/golf-java/build/org/json/JSONObject.class +0 -0
  36. data/golf-java/build/org/json/JSONString.class +0 -0
  37. data/golf-java/build/org/json/JSONStringer.class +0 -0
  38. data/golf-java/build/org/json/JSONTokener.class +0 -0
  39. data/golf-java/build/org/json/JSONWriter.class +0 -0
  40. data/golf-java/build/resources.zip +0 -0
  41. data/golf-java/build.xml +0 -174
  42. data/golf-java/dist/golf.zip +0 -0
  43. data/golf-java/lib/ant-launcher.jar +0 -0
  44. data/golf-java/lib/ant.jar +0 -0
  45. data/golf-java/lib/commons-codec-1.4.jar +0 -0
  46. data/golf-java/lib/commons-collections-3.2.1.jar +0 -0
  47. data/golf-java/lib/commons-fileupload-1.2.1.jar +0 -0
  48. data/golf-java/lib/commons-httpclient-3.1.jar +0 -0
  49. data/golf-java/lib/commons-io-1.4.jar +0 -0
  50. data/golf-java/lib/commons-lang-2.4.jar +0 -0
  51. data/golf-java/lib/commons-logging-1.1.1.jar +0 -0
  52. data/golf-java/lib/cssparser-0.9.5.jar +0 -0
  53. data/golf-java/lib/getopt-0.1-dev.jar +0 -0
  54. data/golf-java/lib/htmlunit-2.6.jar +0 -0
  55. data/golf-java/lib/htmlunit-core-js-2.6.jar +0 -0
  56. data/golf-java/lib/java-xmlbuilder-1.jar +0 -0
  57. data/golf-java/lib/jets3t-0.7.0.jar +0 -0
  58. data/golf-java/lib/jetty-6.1.15.jar +0 -0
  59. data/golf-java/lib/jetty-util-6.1.15.jar +0 -0
  60. data/golf-java/lib/log4j-1.2.15.jar +0 -0
  61. data/golf-java/lib/nekohtml-1.9.13.jar +0 -0
  62. data/golf-java/lib/sac-1.3.jar +0 -0
  63. data/golf-java/lib/serializer-2.7.1.jar +0 -0
  64. data/golf-java/lib/servlet-api-2.5-20081211.jar +0 -0
  65. data/golf-java/lib/xalan-2.7.1.jar +0 -0
  66. data/golf-java/lib/xercesImpl-2.9.1.jar +0 -0
  67. data/golf-java/lib/xml-apis-1.3.04.jar +0 -0
  68. data/golf-java/resources/app_error.html +0 -60
  69. data/golf-java/resources/error.html +0 -29
  70. data/golf-java/resources/forcebot.txt +0 -0
  71. data/golf-java/resources/forceclient.txt +0 -0
  72. data/golf-java/resources/forceproxy.txt +0 -0
  73. data/golf-java/resources/head.html +0 -0
  74. data/golf-java/resources/jquery.address.js +0 -439
  75. data/golf-java/resources/jquery.golf.js +0 -945
  76. data/golf-java/resources/jquery.js +0 -4376
  77. data/golf-java/resources/jsdetect.html +0 -23
  78. data/golf-java/resources/loading.gif +0 -0
  79. data/golf-java/resources/new.html +0 -45
  80. data/golf-java/resources/new.static.html +0 -45
  81. data/golf-java/resources/noscript.forceclient.html +0 -11
  82. data/golf-java/resources/noscript.html +0 -18
  83. data/golf-java/resources/noscript.static.html +0 -15
  84. data/golf-java/resources/project.xml +0 -21
  85. data/golf-java/resources/proxy_project.xml +0 -11
  86. data/golf-java/resources/proxy_web.xml +0 -40
  87. data/golf-java/resources/static_project.xml +0 -37
  88. data/golf-java/resources/version +0 -1
  89. data/golf-java/resources/web.xml +0 -36
  90. data/golf-java/resources/welcome2golf.html +0 -50
  91. data/golf-java/src/com/thinkminimo/golf/GolfResource.java +0 -582
  92. data/golf-java/src/com/thinkminimo/golf/GolfServlet.java +0 -1055
  93. data/golf-java/src/com/thinkminimo/golf/JsonpTunnel.java +0 -86
  94. data/golf-java/src/com/thinkminimo/golf/Main.java +0 -1299
  95. data/golf-java/src/com/thinkminimo/golf/ProxyServlet.java +0 -577
  96. data/golf-java/src/com/yahoo/platform/yui/compressor/CssCompressor.java +0 -188
  97. data/golf-java/src/com/yahoo/platform/yui/compressor/JarClassLoader.java +0 -158
  98. data/golf-java/src/com/yahoo/platform/yui/compressor/JavaScriptCompressor.java +0 -1281
  99. data/golf-java/src/com/yahoo/platform/yui/compressor/JavaScriptIdentifier.java +0 -55
  100. data/golf-java/src/com/yahoo/platform/yui/compressor/JavaScriptToken.java +0 -28
  101. data/golf-java/src/com/yahoo/platform/yui/compressor/ScriptOrFnScope.java +0 -160
  102. data/golf-java/src/org/json/JSONArray.java +0 -934
  103. data/golf-java/src/org/json/JSONException.java +0 -27
  104. data/golf-java/src/org/json/JSONObject.java +0 -1550
  105. data/golf-java/src/org/json/JSONString.java +0 -18
  106. data/golf-java/src/org/json/JSONStringer.java +0 -78
  107. data/golf-java/src/org/json/JSONTokener.java +0 -422
  108. data/golf-java/src/org/json/JSONWriter.java +0 -323
  109. data/golf-java/test/client/golftest/README.markdown +0 -3
  110. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.css +0 -114
  111. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.html +0 -17
  112. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.js +0 -81
  113. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.res/asc.gif +0 -0
  114. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.res/bg.gif +0 -0
  115. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.res/desc.gif +0 -0
  116. data/golf-java/test/client/golftest/components/com/thinkminimo/golf/test/Harness.res/test/test.html +0 -1
  117. data/golf-java/test/client/golftest/controller.js +0 -131
  118. data/golf-java/test/client/golftest/forceclient.txt +0 -0
  119. data/golf-java/test/client/golftest/forceproxy.txt +0 -0
  120. data/golf-java/test/client/golftest/head.html +0 -1
  121. data/golf-java/test/client/golftest/scripts/jquery.tablesort.js +0 -75
  122. data/golf-java/test/client/golftest/styles/style.css +0 -18
  123. data/golf-java/test/client/golftest/test/test.html +0 -1
@@ -1,323 +0,0 @@
1
- package org.json;
2
-
3
- import java.io.IOException;
4
- import java.io.Writer;
5
-
6
- /*
7
- Copyright (c) 2006 JSON.org
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- The Software shall be used for Good, not Evil.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
- */
29
-
30
- /**
31
- * JSONWriter provides a quick and convenient way of producing JSON text.
32
- * The texts produced strictly conform to JSON syntax rules. No whitespace is
33
- * added, so the results are ready for transmission or storage. Each instance of
34
- * JSONWriter can produce one JSON text.
35
- * <p>
36
- * A JSONWriter instance provides a <code>value</code> method for appending
37
- * values to the
38
- * text, and a <code>key</code>
39
- * method for adding keys before values in objects. There are <code>array</code>
40
- * and <code>endArray</code> methods that make and bound array values, and
41
- * <code>object</code> and <code>endObject</code> methods which make and bound
42
- * object values. All of these methods return the JSONWriter instance,
43
- * permitting a cascade style. For example, <pre>
44
- * new JSONWriter(myWriter)
45
- * .object()
46
- * .key("JSON")
47
- * .value("Hello, World!")
48
- * .endObject();</pre> which writes <pre>
49
- * {"JSON":"Hello, World!"}</pre>
50
- * <p>
51
- * The first method called must be <code>array</code> or <code>object</code>.
52
- * There are no methods for adding commas or colons. JSONWriter adds them for
53
- * you. Objects and arrays can be nested up to 20 levels deep.
54
- * <p>
55
- * This can sometimes be easier than using a JSONObject to build a string.
56
- * @author JSON.org
57
- * @version 2008-09-18
58
- */
59
- public class JSONWriter {
60
- private static final int maxdepth = 20;
61
-
62
- /**
63
- * The comma flag determines if a comma should be output before the next
64
- * value.
65
- */
66
- private boolean comma;
67
-
68
- /**
69
- * The current mode. Values:
70
- * 'a' (array),
71
- * 'd' (done),
72
- * 'i' (initial),
73
- * 'k' (key),
74
- * 'o' (object).
75
- */
76
- protected char mode;
77
-
78
- /**
79
- * The object/array stack.
80
- */
81
- private JSONObject stack[];
82
-
83
- /**
84
- * The stack top index. A value of 0 indicates that the stack is empty.
85
- */
86
- private int top;
87
-
88
- /**
89
- * The writer that will receive the output.
90
- */
91
- protected Writer writer;
92
-
93
- /**
94
- * Make a fresh JSONWriter. It can be used to build one JSON text.
95
- */
96
- public JSONWriter(Writer w) {
97
- this.comma = false;
98
- this.mode = 'i';
99
- this.stack = new JSONObject[maxdepth];
100
- this.top = 0;
101
- this.writer = w;
102
- }
103
-
104
- /**
105
- * Append a value.
106
- * @param s A string value.
107
- * @return this
108
- * @throws JSONException If the value is out of sequence.
109
- */
110
- private JSONWriter append(String s) throws JSONException {
111
- if (s == null) {
112
- throw new JSONException("Null pointer");
113
- }
114
- if (this.mode == 'o' || this.mode == 'a') {
115
- try {
116
- if (this.comma && this.mode == 'a') {
117
- this.writer.write(',');
118
- }
119
- this.writer.write(s);
120
- } catch (IOException e) {
121
- throw new JSONException(e);
122
- }
123
- if (this.mode == 'o') {
124
- this.mode = 'k';
125
- }
126
- this.comma = true;
127
- return this;
128
- }
129
- throw new JSONException("Value out of sequence.");
130
- }
131
-
132
- /**
133
- * Begin appending a new array. All values until the balancing
134
- * <code>endArray</code> will be appended to this array. The
135
- * <code>endArray</code> method must be called to mark the array's end.
136
- * @return this
137
- * @throws JSONException If the nesting is too deep, or if the object is
138
- * started in the wrong place (for example as a key or after the end of the
139
- * outermost array or object).
140
- */
141
- public JSONWriter array() throws JSONException {
142
- if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
143
- this.push(null);
144
- this.append("[");
145
- this.comma = false;
146
- return this;
147
- }
148
- throw new JSONException("Misplaced array.");
149
- }
150
-
151
- /**
152
- * End something.
153
- * @param m Mode
154
- * @param c Closing character
155
- * @return this
156
- * @throws JSONException If unbalanced.
157
- */
158
- private JSONWriter end(char m, char c) throws JSONException {
159
- if (this.mode != m) {
160
- throw new JSONException(m == 'o' ? "Misplaced endObject." :
161
- "Misplaced endArray.");
162
- }
163
- this.pop(m);
164
- try {
165
- this.writer.write(c);
166
- } catch (IOException e) {
167
- throw new JSONException(e);
168
- }
169
- this.comma = true;
170
- return this;
171
- }
172
-
173
- /**
174
- * End an array. This method most be called to balance calls to
175
- * <code>array</code>.
176
- * @return this
177
- * @throws JSONException If incorrectly nested.
178
- */
179
- public JSONWriter endArray() throws JSONException {
180
- return this.end('a', ']');
181
- }
182
-
183
- /**
184
- * End an object. This method most be called to balance calls to
185
- * <code>object</code>.
186
- * @return this
187
- * @throws JSONException If incorrectly nested.
188
- */
189
- public JSONWriter endObject() throws JSONException {
190
- return this.end('k', '}');
191
- }
192
-
193
- /**
194
- * Append a key. The key will be associated with the next value. In an
195
- * object, every value must be preceded by a key.
196
- * @param s A key string.
197
- * @return this
198
- * @throws JSONException If the key is out of place. For example, keys
199
- * do not belong in arrays or if the key is null.
200
- */
201
- public JSONWriter key(String s) throws JSONException {
202
- if (s == null) {
203
- throw new JSONException("Null key.");
204
- }
205
- if (this.mode == 'k') {
206
- try {
207
- if (this.comma) {
208
- this.writer.write(',');
209
- }
210
- stack[top - 1].putOnce(s, Boolean.TRUE);
211
- this.writer.write(JSONObject.quote(s));
212
- this.writer.write(':');
213
- this.comma = false;
214
- this.mode = 'o';
215
- return this;
216
- } catch (IOException e) {
217
- throw new JSONException(e);
218
- }
219
- }
220
- throw new JSONException("Misplaced key.");
221
- }
222
-
223
-
224
- /**
225
- * Begin appending a new object. All keys and values until the balancing
226
- * <code>endObject</code> will be appended to this object. The
227
- * <code>endObject</code> method must be called to mark the object's end.
228
- * @return this
229
- * @throws JSONException If the nesting is too deep, or if the object is
230
- * started in the wrong place (for example as a key or after the end of the
231
- * outermost array or object).
232
- */
233
- public JSONWriter object() throws JSONException {
234
- if (this.mode == 'i') {
235
- this.mode = 'o';
236
- }
237
- if (this.mode == 'o' || this.mode == 'a') {
238
- this.append("{");
239
- this.push(new JSONObject());
240
- this.comma = false;
241
- return this;
242
- }
243
- throw new JSONException("Misplaced object.");
244
-
245
- }
246
-
247
-
248
- /**
249
- * Pop an array or object scope.
250
- * @param c The scope to close.
251
- * @throws JSONException If nesting is wrong.
252
- */
253
- private void pop(char c) throws JSONException {
254
- if (this.top <= 0) {
255
- throw new JSONException("Nesting error.");
256
- }
257
- char m = this.stack[this.top - 1] == null ? 'a' : 'k';
258
- if (m != c) {
259
- throw new JSONException("Nesting error.");
260
- }
261
- this.top -= 1;
262
- this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
263
- }
264
-
265
- /**
266
- * Push an array or object scope.
267
- * @param c The scope to open.
268
- * @throws JSONException If nesting is too deep.
269
- */
270
- private void push(JSONObject jo) throws JSONException {
271
- if (this.top >= maxdepth) {
272
- throw new JSONException("Nesting too deep.");
273
- }
274
- this.stack[this.top] = jo;
275
- this.mode = jo == null ? 'a' : 'k';
276
- this.top += 1;
277
- }
278
-
279
-
280
- /**
281
- * Append either the value <code>true</code> or the value
282
- * <code>false</code>.
283
- * @param b A boolean.
284
- * @return this
285
- * @throws JSONException
286
- */
287
- public JSONWriter value(boolean b) throws JSONException {
288
- return this.append(b ? "true" : "false");
289
- }
290
-
291
- /**
292
- * Append a double value.
293
- * @param d A double.
294
- * @return this
295
- * @throws JSONException If the number is not finite.
296
- */
297
- public JSONWriter value(double d) throws JSONException {
298
- return this.value(new Double(d));
299
- }
300
-
301
- /**
302
- * Append a long value.
303
- * @param l A long.
304
- * @return this
305
- * @throws JSONException
306
- */
307
- public JSONWriter value(long l) throws JSONException {
308
- return this.append(Long.toString(l));
309
- }
310
-
311
-
312
- /**
313
- * Append an object value.
314
- * @param o The object to append. It can be null, or a Boolean, Number,
315
- * String, JSONObject, or JSONArray, or an object with a toJSONString()
316
- * method.
317
- * @return this
318
- * @throws JSONException If the value is out of sequence.
319
- */
320
- public JSONWriter value(Object o) throws JSONException {
321
- return this.append(JSONObject.valueToString(o));
322
- }
323
- }
@@ -1,3 +0,0 @@
1
- ## Working on this document. ##
2
-
3
- Stay tuned...
@@ -1,114 +0,0 @@
1
- table {
2
- margin: 0;
3
- padding: 0;
4
- }
5
-
6
- a.golfproxylink {
7
- text-decoration: inherit;
8
- color: inherit;
9
- }
10
-
11
- table.formtable {
12
- width: 100%;
13
- }
14
-
15
- input.text, textarea {
16
- width: 100%;
17
- border: 1px solid gray;
18
- padding: 2px;
19
- }
20
-
21
- input.submit, select {
22
- width: 100%;
23
- }
24
-
25
- table.tests {
26
- border: 1px solid black;
27
- margin: 2em auto;
28
- }
29
-
30
- table.tests > thead > tr > th > div {
31
- width: 100%;
32
- padding-left: 0.25em;
33
- text-align: left;
34
- background-image: url('?resource=bg.gif');
35
- background-position: center right;
36
- background-repeat: no-repeat;
37
- }
38
-
39
- table.tests > thead > tr > th > div.sort-asc {
40
- background-image: url('?resource=asc.gif');
41
- }
42
- table.tests > thead > tr > th > div.sort-desc {
43
- background-image: url('?resource=desc.gif');
44
- }
45
-
46
- table.tests > thead > tr > th {
47
- border-bottom: 1px solid black;
48
- }
49
-
50
- table.tests > thead > tr > th > * {
51
- cursor: pointer;
52
- }
53
-
54
- table.tests > tbody > tr > td {
55
- border-bottom: 1px solid gray;
56
- border-right: 1px solid gray;
57
- }
58
-
59
- table.tests > tbody > tr.even {
60
- background: #eeeeff;
61
- }
62
-
63
- table.tests > tbody > tr.odd {
64
- background: #ffffff;
65
- }
66
-
67
- table.tests > tbody > tr > td.pass,
68
- table.tests > tbody > tr > td.fail,
69
- table.tests > tbody > tr > td.error,
70
- table.tests > tbody > tr > td.none,
71
- table.tests > tbody > tr > td.wait {
72
- font-family: monospace;
73
- padding: 0px 5px 0px 5px;
74
- text-align: center;
75
- border-right: none;
76
- }
77
-
78
- table.tests > tbody > tr > td.pass {
79
- color: green;
80
- background: lightgreen;
81
- }
82
-
83
- table.tests > tbody > tr > td.fail {
84
- color: red;
85
- background: pink;
86
- }
87
-
88
- table.tests > tbody > tr > td.error {
89
- color: white;
90
- background: red;
91
- width: 100%;
92
- }
93
-
94
- table.tests > tbody > tr > td.wait {
95
- color: red;
96
- background: gold;
97
- width: 100%;
98
- }
99
-
100
- table.tests > tbody > tr > td.none {
101
- color: #666;
102
- background: lightgray;
103
- }
104
-
105
- .testnum {
106
- font-family: monospace;
107
- text-align: right;
108
- padding: 0px 5px 0px 5px;
109
- }
110
-
111
- .testcase {
112
- font-family: monospace;
113
- padding: 0px 5px 0px 5px;
114
- }
@@ -1,17 +0,0 @@
1
- <div>
2
- <table class="tests" cellpadding="0px" cellspacing="0px" width="800px">
3
- <colgroup>
4
- <col width="5em"/>
5
- <col width="85%"/>
6
- <col width="15%"/>
7
- </colgroup>
8
- <thead>
9
- <tr>
10
- <th><div>#</div></th>
11
- <th><div>test</div></th>
12
- <th><div>result</div></th>
13
- </tr>
14
- </thead>
15
- <tbody></tbody>
16
- </table>
17
- </div>
@@ -1,81 +0,0 @@
1
- function() {
2
-
3
- //----------------- public methods, instance variables -------------------//
4
-
5
- this.test = function(name, assertion) {
6
- var ret;
7
-
8
- if (!name.match(/</) && !name.nodeType && !name.jquery && !name._dom)
9
- name = $("<span/>").text(name);
10
-
11
- $(".current").removeClass("current");
12
-
13
- $("table.tests > tbody").append(
14
- $("<tr/>").append(
15
- $("<td/>").addClass("testnum").text(++tests)
16
- ).append(
17
- $("<td/>").addClass("testcase").append(name)
18
- ).append(
19
- ret = $("<td/>").addClass("current")
20
- )
21
- );
22
-
23
- this.none(ret);
24
-
25
- if (assertion !== undefined)
26
- this.assert(assertion);
27
-
28
- $("table.tests").trigger('sort');
29
-
30
- return ret;
31
- };
32
-
33
- this.assert = function(assertion, elem) {
34
- var result;
35
-
36
- if (typeof(assertion) === "function") {
37
- try {
38
- result = assertion();
39
- } catch (e) {
40
- this.error(elem);
41
- return;
42
- }
43
- } else if (assertion !== undefined) {
44
- result = !!assertion;
45
- }
46
-
47
- this[(result === undefined ? "none" : (result ? "pass" : "fail"))](elem);
48
- };
49
-
50
- var comp = this;
51
-
52
- var stats = [
53
- { name: "none", mesg: "SKIPPED" },
54
- { name: "pass", mesg: "PASSED" },
55
- { name: "fail", mesg: "FAILED" },
56
- { name: "error", mesg: "ERROR" },
57
- { name: "wait", mesg: "WAITING" }
58
- ];
59
-
60
- $.each(stats, function(i_stat, v_stat) {
61
- var mesg = v_stat.mesg;
62
- comp[v_stat.name] = function(e) {
63
- e = $(!!e ? e : ".current");
64
- $.each(stats, function(k,v) { e.removeClass(v.name) });
65
- e.addClass(v_stat.name).text(v_stat.mesg);
66
- };
67
- });
68
-
69
- //----------------- private methods, instance variables ------------------//
70
-
71
- var tests = 0;
72
-
73
- //----------------- initialization ---------------------------------------//
74
-
75
- $("table.tests").bind('sort', function() {
76
- $("tbody > tr", this).not($("td table *", this)).each(function(k,v) {
77
- $(this).removeClass(["odd","even"][k%2]).addClass(["even","odd"][k%2]);
78
- });
79
- }).makeSortable();
80
-
81
- }
@@ -1,131 +0,0 @@
1
-
2
- // import namespaces
3
- eval($.Import("Component.com.thinkminimo.golf.test.Harness"));
4
-
5
- // this is the default action name, in case no action was specified
6
- $.golf.defaultRoute = "/tests/foo/bar/";
7
-
8
- // this defines the golf controller
9
- $.golf.controller = [
10
-
11
- // action for the /test/something/ routes
12
- { route: "^/tests/([^/]+)/([^/]+)/$",
13
- action: (function() {
14
- var t = new Harness();
15
-
16
- return function(b, match) {
17
- b.empty().append(t);
18
-
19
- t.test("route regexps", function() {
20
- return match[1] == "foo" && match[2] == "bar";
21
- });
22
-
23
- (function(tmp) {
24
- t.wait(tmp);
25
- $("form.test1").submit(function() {
26
- t.assert(
27
- $("[name='typeyes']").val() == "typedy type" &&
28
- $("[name='txtarea']").val() == "this man is not to be trusted" &&
29
- $("[name='selection']").val() == "lizards",
30
- tmp);
31
- $("input[type='submit']").val("Thanks!").attr("disabled", "true");
32
- return false;
33
- });
34
- })(t.test(
35
- "<form class='test1'>"+
36
- "<table class='formtable'>"+
37
- "<colgroup>"+
38
- "<col width='20%'/>"+
39
- "<col width='80%'/>"+
40
- "</colgroup>"+
41
- "<thead></thead>"+
42
- "<tbody>"+
43
- "<tr>"+
44
- "<td>one: </td>"+
45
- "<td>"+
46
- "<input type='text' class='text' name='typeyes' "+
47
- "value='typedy type' disabled='yes'/>"+
48
- "</td>"+
49
- "</tr><tr>"+
50
- "<td>two: </td>"+
51
- "<td>"+
52
- "<textarea rows='5' name='txtarea' disabled='yes'>"+
53
- "this man is not to be trusted"+
54
- "</textarea>"+
55
- "</td>"+
56
- "</tr><tr>"+
57
- "<td>three: </td>"+
58
- "<td>"+
59
- "<select name='selection' disabled='yes'>"+
60
- "<option value='cats'>Cats</option>"+
61
- "<option value='dogs'>Dogs</option>"+
62
- "<option value='lizards' selected='selected'>"+
63
- "lizards"+
64
- "</option>"+
65
- "</select>"+
66
- "</td>"+
67
- "</tr><tr>"+
68
- "<td></td>"+
69
- "<td>"+
70
- "<input type='submit' class='submit' value='Click me!'/>"+
71
- "</td>"+
72
- "</tr>"+
73
- "</tbody>"+
74
- "</table>"+
75
- "</form>"
76
- ));
77
-
78
- t.test("head.html");
79
-
80
- t.test("constructor argv", (match[1] == "foo" && match[2] == "bar"));
81
-
82
- (function(tmp) {
83
- $.get("?path=controller.js", function(data) {
84
- t.assert(data.length > 10, tmp);
85
- });
86
- })(t.test("AJAX GET"));
87
-
88
- t.test("AJAX POST");
89
-
90
- t.test("AJAX PUT");
91
-
92
- t.test("AJAX DELETE");
93
-
94
- (function(tmp) {
95
- // flickr.com api url
96
- var url = "http://api.flickr.com/services/feeds/photos_public.gne"+
97
- "?tags=dogs&tagmode=any&format=json&jsoncallback=?";
98
- t.fail(tmp);
99
- $.getJSON(url, function(data) {
100
- if (!data.items || data.items.length == 0)
101
- t.error(tmp);
102
- else
103
- t.pass(tmp);
104
- });
105
- })(t.test("JSONP GET"));
106
-
107
- (function(tmp) {
108
- $.get($.golf.res.test["test.html"], function(data) {
109
- t.assert(data == "PASS\n");
110
- });
111
- })(t.test("$.golf.res object"));
112
-
113
- t.test("$.component.res object");
114
- /*
115
- $.get($.component.res.test["test.html"], function(data) {
116
- t.assert(data == "PASS\n");
117
- });
118
- */
119
- return false;
120
- };
121
- })()
122
- },
123
-
124
- // the default action
125
- { route: ".*",
126
- action: function(b, match) {
127
- $.golf.location($.golf.defaultRoute);
128
- }
129
- }
130
-
131
- ];
File without changes
File without changes
@@ -1 +0,0 @@
1
- <style type="text/javascript" class="head-html">/*PASS*/</style>