Fingertips-headless-squirrel 0.2.0

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 (124) hide show
  1. data/README.rdoc +53 -0
  2. data/Rakefile +49 -0
  3. data/VERSION.yml +4 -0
  4. data/bin/jstest +10 -0
  5. data/lib/headless_squirrel/runner.rb +70 -0
  6. data/lib/headless_squirrel/test.rb +17 -0
  7. data/lib/headless_squirrel/test_case.rb +121 -0
  8. data/lib/headless_squirrel.rb +2 -0
  9. data/test/fixtures/a_unit_test.html +27 -0
  10. data/test/fixtures/a_unit_test.js +22 -0
  11. data/test/regression/prototype/unit/ajax_test.html +29 -0
  12. data/test/regression/prototype/unit/array_test.html +28 -0
  13. data/test/regression/prototype/unit/assets/prototype.js +4900 -0
  14. data/test/regression/prototype/unit/assets/unittest.css +50 -0
  15. data/test/regression/prototype/unit/assets/unittest.js +615 -0
  16. data/test/regression/prototype/unit/assets/unittest_transport.js +1 -0
  17. data/test/regression/prototype/unit/base_test.html +27 -0
  18. data/test/regression/prototype/unit/class_test.html +27 -0
  19. data/test/regression/prototype/unit/date_test.html +27 -0
  20. data/test/regression/prototype/unit/dom_test.html +304 -0
  21. data/test/regression/prototype/unit/element_mixins_test.html +30 -0
  22. data/test/regression/prototype/unit/enumerable_test.html +35 -0
  23. data/test/regression/prototype/unit/event_test.html +31 -0
  24. data/test/regression/prototype/unit/fixtures/ajax.html +2 -0
  25. data/test/regression/prototype/unit/fixtures/ajax.js +42 -0
  26. data/test/regression/prototype/unit/fixtures/array.html +1 -0
  27. data/test/regression/prototype/unit/fixtures/class.js +83 -0
  28. data/test/regression/prototype/unit/fixtures/content.html +1 -0
  29. data/test/regression/prototype/unit/fixtures/data.json +1 -0
  30. data/test/regression/prototype/unit/fixtures/dom.css +84 -0
  31. data/test/regression/prototype/unit/fixtures/dom.html +278 -0
  32. data/test/regression/prototype/unit/fixtures/dom.js +17 -0
  33. data/test/regression/prototype/unit/fixtures/element_mixins.html +4 -0
  34. data/test/regression/prototype/unit/fixtures/element_mixins.js +2 -0
  35. data/test/regression/prototype/unit/fixtures/empty.html +0 -0
  36. data/test/regression/prototype/unit/fixtures/empty.js +1 -0
  37. data/test/regression/prototype/unit/fixtures/enumerable.html +8 -0
  38. data/test/regression/prototype/unit/fixtures/enumerable.js +23 -0
  39. data/test/regression/prototype/unit/fixtures/event.html +4 -0
  40. data/test/regression/prototype/unit/fixtures/form.html +108 -0
  41. data/test/regression/prototype/unit/fixtures/function.js +13 -0
  42. data/test/regression/prototype/unit/fixtures/hash.js +25 -0
  43. data/test/regression/prototype/unit/fixtures/hello.js +1 -0
  44. data/test/regression/prototype/unit/fixtures/logo.gif +0 -0
  45. data/test/regression/prototype/unit/fixtures/object.html +6 -0
  46. data/test/regression/prototype/unit/fixtures/object.js +7 -0
  47. data/test/regression/prototype/unit/fixtures/position.html +9 -0
  48. data/test/regression/prototype/unit/fixtures/selector.html +71 -0
  49. data/test/regression/prototype/unit/fixtures/string.js +8 -0
  50. data/test/regression/prototype/unit/fixtures/unittest.html +18 -0
  51. data/test/regression/prototype/unit/form_test.html +135 -0
  52. data/test/regression/prototype/unit/function_test.html +27 -0
  53. data/test/regression/prototype/unit/hash_test.html +27 -0
  54. data/test/regression/prototype/unit/number_test.html +27 -0
  55. data/test/regression/prototype/unit/object_test.html +32 -0
  56. data/test/regression/prototype/unit/periodical_executer_test.html +27 -0
  57. data/test/regression/prototype/unit/position_test.html +36 -0
  58. data/test/regression/prototype/unit/prototype_test.html +27 -0
  59. data/test/regression/prototype/unit/range_test.html +27 -0
  60. data/test/regression/prototype/unit/regexp_test.html +27 -0
  61. data/test/regression/prototype/unit/selector_test.html +98 -0
  62. data/test/regression/prototype/unit/string_test.html +27 -0
  63. data/test/regression/prototype/unit/tests/ajax_test.js +379 -0
  64. data/test/regression/prototype/unit/tests/array_test.js +186 -0
  65. data/test/regression/prototype/unit/tests/base_test.js +43 -0
  66. data/test/regression/prototype/unit/tests/class_test.js +136 -0
  67. data/test/regression/prototype/unit/tests/date_test.js +5 -0
  68. data/test/regression/prototype/unit/tests/dom_test.js +1493 -0
  69. data/test/regression/prototype/unit/tests/element_mixins_test.js +32 -0
  70. data/test/regression/prototype/unit/tests/enumerable_test.js +271 -0
  71. data/test/regression/prototype/unit/tests/event_test.js +235 -0
  72. data/test/regression/prototype/unit/tests/form_test.js +382 -0
  73. data/test/regression/prototype/unit/tests/function_test.js +133 -0
  74. data/test/regression/prototype/unit/tests/hash_test.js +178 -0
  75. data/test/regression/prototype/unit/tests/number_test.js +44 -0
  76. data/test/regression/prototype/unit/tests/object_test.js +180 -0
  77. data/test/regression/prototype/unit/tests/periodical_executer_test.js +15 -0
  78. data/test/regression/prototype/unit/tests/position_test.js +44 -0
  79. data/test/regression/prototype/unit/tests/prototype_test.js +43 -0
  80. data/test/regression/prototype/unit/tests/range_test.js +58 -0
  81. data/test/regression/prototype/unit/tests/regexp_test.js +42 -0
  82. data/test/regression/prototype/unit/tests/selector_test.js +408 -0
  83. data/test/regression/prototype/unit/tests/string_test.js +548 -0
  84. data/test/regression/prototype/unit/tests/unittest_test.js +148 -0
  85. data/test/regression/prototype/unit/unittest_test.html +45 -0
  86. data/test/regression/prototype/upstream +1 -0
  87. data/test/regression/scriptaculous/src/builder.js +134 -0
  88. data/test/regression/scriptaculous/src/controls.js +963 -0
  89. data/test/regression/scriptaculous/src/dragdrop.js +973 -0
  90. data/test/regression/scriptaculous/src/effects.js +1122 -0
  91. data/test/regression/scriptaculous/src/javascripttest.rb +203 -0
  92. data/test/regression/scriptaculous/src/scriptaculous.js +66 -0
  93. data/test/regression/scriptaculous/src/slider.js +273 -0
  94. data/test/regression/scriptaculous/src/sound.js +57 -0
  95. data/test/regression/scriptaculous/src/unittest.js +566 -0
  96. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_ipce_alt_text.html +1 -0
  97. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_ipce_collection.js +1 -0
  98. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_result.html +1 -0
  99. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_result2.html +1 -0
  100. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_tagged.html +1 -0
  101. data/test/regression/scriptaculous/unit/_ajax_inplaceeditor_text.html +1 -0
  102. data/test/regression/scriptaculous/unit/_ajax_updater_result.html +20 -0
  103. data/test/regression/scriptaculous/unit/_autocomplete_result.html +11 -0
  104. data/test/regression/scriptaculous/unit/_autocomplete_result_nobr.html +1 -0
  105. data/test/regression/scriptaculous/unit/ajax_autocompleter_test.html +243 -0
  106. data/test/regression/scriptaculous/unit/ajax_inplaceeditor_test.html +895 -0
  107. data/test/regression/scriptaculous/unit/builder_test.html +262 -0
  108. data/test/regression/scriptaculous/unit/dragdrop_test.html +131 -0
  109. data/test/regression/scriptaculous/unit/effects_test.html +547 -0
  110. data/test/regression/scriptaculous/unit/element_test.html +116 -0
  111. data/test/regression/scriptaculous/unit/icon.png +0 -0
  112. data/test/regression/scriptaculous/unit/index.html +70 -0
  113. data/test/regression/scriptaculous/unit/loading_test.html +41 -0
  114. data/test/regression/scriptaculous/unit/position_clone_test.html +312 -0
  115. data/test/regression/scriptaculous/unit/slider_test.html +437 -0
  116. data/test/regression/scriptaculous/unit/sortable_test.html +205 -0
  117. data/test/regression/scriptaculous/unit/string_test.html +71 -0
  118. data/test/regression/scriptaculous/unit/unittest_test.html +154 -0
  119. data/test/regression/scriptaculous/upstream +1 -0
  120. data/test/test_helper.rb +20 -0
  121. data/test/unit/runner_test.rb +165 -0
  122. data/test/unit/test_case_test.rb +168 -0
  123. data/test/unit/test_test.rb +24 -0
  124. metadata +179 -0
@@ -0,0 +1,243 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!-- vim:expandtab=on
4
+ -->
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <title>script.aculo.us Unit test file</title>
8
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
9
+ <script src="../../prototype/unit/assets/prototype.js" type="text/javascript"></script>
10
+ <script src="../src/scriptaculous.js" type="text/javascript"></script>
11
+ <script src="../../prototype/unit/assets/unittest.js" type="text/javascript"></script>
12
+ <link rel="stylesheet" href="../../prototype/unit/assets/unittest.css" type="text/css" />
13
+ <style>
14
+ .selected { background-color: #888; }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <h1>script.aculo.us Unit test file</h1>
19
+ <p>
20
+ Tests for Ajax.Autocompleter in controls.js.
21
+ </p>
22
+
23
+ <!-- Log output -->
24
+ <div id="testlog"> </div>
25
+
26
+ <input id="ac_input" type="text" autocomplete="off" />
27
+ <div id="ac_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
28
+
29
+ <input id="ac_input_br" type="text" autocomplete="off" />
30
+ <div id="ac_update_br" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
31
+
32
+ <input id="ac2_input" type="text" autocomplete="off" />
33
+ <div id="ac2_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
34
+
35
+ <input id="actoken_input" type="text" autocomplete="off" />
36
+ <div id="actoken_update" style="display:none;border:1px solid black;background-color:white;position:relative;"></div>
37
+
38
+ <input id="dummy_element" type="text" autocomplete="off" />
39
+
40
+ <!-- Tests follow -->
41
+ <script type="text/javascript" language="javascript" charset="utf-8">
42
+ // <![CDATA[
43
+
44
+
45
+ new Test.Unit.Runner({
46
+
47
+ // Integration test, tests the entire cycle
48
+ testAjaxAutocompleter: function() { with(this) {
49
+ var ac = new Ajax.Autocompleter('ac_input','ac_update','_autocomplete_result.html',
50
+ { method: 'get' }); //override so we can use a static for the result
51
+ assertInstanceOf(Ajax.Autocompleter, ac);
52
+
53
+ // box not visible
54
+ assertNotVisible('ac_update');
55
+
56
+ // focus, but box not visible
57
+ Event.simulateMouse('ac_input', 'click');
58
+ assertNotVisible('ac_update');
59
+
60
+ Event.simulateKeys('ac_input','abcdefg');
61
+ assertEqual('abcdefg', $('ac_input').value);
62
+
63
+ // check box popping up on input
64
+ wait(1000, function() { with(this) {
65
+ assertVisible('ac_update');
66
+ assertEqual('test1', $('ac_update').firstChild.firstChild.innerHTML);
67
+ assertEqual('test2', $('ac_update').firstChild.firstChild.nextSibling.innerHTML);
68
+
69
+ // intl. characters return (UTF-8)
70
+ assertEqual('Here we have some international ©∏Á®Äç†∑rß', $('ac_update').firstChild.lastChild.innerHTML);
71
+
72
+ // first entry should be selected
73
+ assert(Element.hasClassName($('ac_update').firstChild.firstChild, 'selected'),'Selected item should have a className of: selected');
74
+
75
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_DOWN});
76
+
77
+ // second entry should be selected
78
+ assert(!Element.hasClassName($('ac_update').firstChild.firstChild),'Item shouldn\'t have a className of: selected');
79
+ assert(Element.hasClassName($('ac_update').firstChild.firstChild.nextSibling, 'selected'),'Second entry should have a className of: selected');
80
+
81
+ // check selecting with <TAB>
82
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_TAB});
83
+ assertEqual('test2',$('ac_input').value);
84
+
85
+ // check box going away
86
+ wait(500, function() { with(this) {
87
+ assertNotVisible('ac_update');
88
+
89
+ // check selecting with mouse click
90
+ Event.simulateKeys('ac_input','3');
91
+ assertEqual('test23', $('ac_input').value);
92
+ wait(1000, function() { with(this) {
93
+ assertVisible('ac_update');
94
+ Event.simulateMouse($('ac_update').firstChild.childNodes[4],'click');
95
+
96
+ wait(1000, function() { with(this) {
97
+ // tests if removal of 'informal' nodes and HTML escaping works
98
+ assertEqual('(GET <ME> INSTEAD)',$('ac_input').value);
99
+ assertNotVisible('ac_update');
100
+
101
+ // check cancelling with <ESC>
102
+ Event.simulateKeys('ac_input','abcdefg');
103
+
104
+ wait(1000, function() { with(this) {
105
+ assertVisible('ac_update');
106
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input').value);
107
+
108
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_DOWN});
109
+ Event.simulateKey('ac_input','keypress',{keyCode:Event.KEY_ESC});
110
+
111
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input').value);
112
+ }});
113
+ }});
114
+ }});
115
+ }});
116
+ }});
117
+ }},
118
+
119
+ testAfterUpdateElement: function() { with(this) {
120
+ var ac = new Ajax.Autocompleter('ac2_input','ac2_update','_autocomplete_result.html',
121
+ { method: 'get',
122
+ afterUpdateElement: function(element,selectedElement) {
123
+ element.value = 'afterupdate:' + selectedElement.tagName;
124
+ }
125
+ });
126
+ assertInstanceOf(Ajax.Autocompleter, ac);
127
+
128
+ Event.simulateMouse('ac2_input', 'click');
129
+ Event.simulateKeys('ac2_input','abcdefg');
130
+
131
+ wait(1000, function() { with(this) {
132
+ assertVisible('ac2_update');
133
+ Event.simulateKey('ac2_input','keypress',{keyCode:Event.KEY_TAB});
134
+
135
+ assertEqual('afterupdate:LI',$('ac2_input').value);
136
+ }});
137
+ }},
138
+
139
+ testTokenizing: function() { with(this) {
140
+ var actoken = new Ajax.Autocompleter('actoken_input','ac_update','_autocomplete_result.html',
141
+ { tokens:',', method: 'get' });
142
+ assertInstanceOf(Ajax.Autocompleter, actoken);
143
+
144
+ Event.simulateKeys('actoken_input','abc');
145
+
146
+ wait(1000, function() { with(this) {
147
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_TAB});
148
+ assertEqual('test1',$('actoken_input').value);
149
+ Event.simulateKeys('actoken_input',',abc');
150
+ wait(1000, function() { with(this) {
151
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_DOWN});
152
+ Event.simulateKey('actoken_input','keypress',{keyCode:Event.KEY_TAB});
153
+ assertEqual('test1,test2',$('actoken_input').value);
154
+ // Simulating KEY_LEFT's prior to a 'b' doesn't work! So slightly ugly here...
155
+ $('actoken_input').value = 'test1b,test2';
156
+ actoken.onObserverEvent();
157
+ wait(1000, function() { with(this) {
158
+ for (var index = 0; index < 2; ++index)
159
+ Event.simulateKey('actoken_input', 'keypress', {keyCode: Event.KEY_DOWN});
160
+ Event.simulateKey('actoken_input', 'keypress', {keyCode: Event.KEY_TAB});
161
+ assertEqual('test3,test2', $('actoken_input').value);
162
+ }});
163
+ }});
164
+ }});
165
+ }},
166
+
167
+ // Same integration test, results has no linebreaks
168
+ testAjaxAutocompleterNoLinebreaksInResult: function() { with(this) {
169
+ var ac = new Ajax.Autocompleter('ac_input_br','ac_update_br','_autocomplete_result_nobr.html',
170
+ { method: 'get' }); //override so we can use a static for the result
171
+ assertInstanceOf(Ajax.Autocompleter, ac);
172
+
173
+ // box not visible
174
+ assertNotVisible('ac_update_br');
175
+
176
+ // focus, but box not visible
177
+ Event.simulateMouse('ac_input_br', 'click');
178
+ assertNotVisible('ac_update_br');
179
+
180
+ Event.simulateKeys('ac_input_br','abcdefg');
181
+ assertEqual('abcdefg', $('ac_input_br').value);
182
+
183
+ // check box popping up on input
184
+ wait(1000, function() { with(this) {
185
+ assertVisible('ac_update_br');
186
+ assertEqual('test1', $('ac_update_br').firstChild.firstChild.innerHTML);
187
+ assertEqual('test2', $('ac_update_br').firstChild.firstChild.nextSibling.innerHTML);
188
+
189
+ // intl. characters return (UTF-8)
190
+ assertEqual('Here we have some international ©∏Á®Äç†∑rß', $('ac_update_br').firstChild.lastChild.innerHTML);
191
+
192
+ // first entry should be selected
193
+ assert(Element.hasClassName($('ac_update_br').firstChild.firstChild, 'selected'),'Selected item should have a className of: selected');
194
+
195
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_DOWN});
196
+
197
+ // second entry should be selected
198
+ assert(!Element.hasClassName($('ac_update_br').firstChild.firstChild),'Item shouldn\'t have a className of: selected');
199
+ assert(Element.hasClassName($('ac_update_br').firstChild.firstChild.nextSibling, 'selected'),'Second entry should have a className of: selected');
200
+
201
+ // check selecting with <TAB>
202
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_TAB});
203
+ assertEqual('test2',$('ac_input_br').value);
204
+
205
+ // check box going away
206
+ wait(500, function() { with(this) {
207
+ assertNotVisible('ac_update_br');
208
+
209
+ // check selecting with mouse click
210
+ Event.simulateKeys('ac_input_br','3');
211
+ assertEqual('test23', $('ac_input_br').value);
212
+ wait(1000, function() { with(this) {
213
+ assertVisible('ac_update_br');
214
+ Event.simulateMouse($('ac_update_br').firstChild.childNodes[4],'click');
215
+
216
+ wait(1000, function() { with(this) {
217
+ // tests if removal of 'informal' nodes and HTML escaping works
218
+ assertEqual('(GET <ME> INSTEAD)',$('ac_input_br').value);
219
+ assertNotVisible('ac_update_br');
220
+
221
+ // check cancelling with <ESC>
222
+ Event.simulateKeys('ac_input_br','abcdefg');
223
+
224
+ wait(1000, function() { with(this) {
225
+ assertVisible('ac_update_br');
226
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input_br').value);
227
+
228
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_DOWN});
229
+ Event.simulateKey('ac_input_br','keypress',{keyCode:Event.KEY_ESC});
230
+
231
+ assertEqual('(GET <ME> INSTEAD)abcdefg', $('ac_input_br').value);
232
+ }});
233
+ }});
234
+ }});
235
+ }});
236
+ }});
237
+ }}
238
+
239
+ });
240
+ // ]]>
241
+ </script>
242
+ </body>
243
+ </html>