javascriptmvc 3.0.0.pre15

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 (550) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/README.markdown +15 -0
  4. data/Rakefile +17 -0
  5. data/VERSION +1 -0
  6. data/bin/jmvc-build +4 -0
  7. data/bin/jmvc-gen +4 -0
  8. data/bin/jmvc-get +4 -0
  9. data/bin/jmvc-init +4 -0
  10. data/bin/jmvc-update +4 -0
  11. data/lib/javascriptmvc.rb +97 -0
  12. data/lib/javascriptmvc/documentjs/README +0 -0
  13. data/lib/javascriptmvc/documentjs/add.js +76 -0
  14. data/lib/javascriptmvc/documentjs/application.js +285 -0
  15. data/lib/javascriptmvc/documentjs/attribute.js +61 -0
  16. data/lib/javascriptmvc/documentjs/baseclass.js +537 -0
  17. data/lib/javascriptmvc/documentjs/class.js +141 -0
  18. data/lib/javascriptmvc/documentjs/constructor.js +145 -0
  19. data/lib/javascriptmvc/documentjs/directives.js +394 -0
  20. data/lib/javascriptmvc/documentjs/distance.js +49 -0
  21. data/lib/javascriptmvc/documentjs/document +21 -0
  22. data/lib/javascriptmvc/documentjs/documentjs.js +76 -0
  23. data/lib/javascriptmvc/documentjs/file.js +55 -0
  24. data/lib/javascriptmvc/documentjs/function.js +112 -0
  25. data/lib/javascriptmvc/documentjs/jmvcdoc/images/close.png +0 -0
  26. data/lib/javascriptmvc/documentjs/jmvcdoc/images/download.png +0 -0
  27. data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-off.png +0 -0
  28. data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-on.png +0 -0
  29. data/lib/javascriptmvc/documentjs/jmvcdoc/images/favicon.ico +0 -0
  30. data/lib/javascriptmvc/documentjs/jmvcdoc/images/logo.png +0 -0
  31. data/lib/javascriptmvc/documentjs/jmvcdoc/images/pre.png +0 -0
  32. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  33. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  34. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  35. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  36. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  37. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  38. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  39. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  40. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_222222_256x240.png +0 -0
  41. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_2e83ff_256x240.png +0 -0
  42. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_454545_256x240.png +0 -0
  43. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_888888_256x240.png +0 -0
  44. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_cd0a0a_256x240.png +0 -0
  45. data/lib/javascriptmvc/documentjs/jmvcdoc/images/video.png +0 -0
  46. data/lib/javascriptmvc/documentjs/jmvcdoc/production.js +552 -0
  47. data/lib/javascriptmvc/documentjs/jmvcdoc/style.css +354 -0
  48. data/lib/javascriptmvc/documentjs/jmvcdoc/summary.ejs +134 -0
  49. data/lib/javascriptmvc/documentjs/json.js +172 -0
  50. data/lib/javascriptmvc/documentjs/page.js +107 -0
  51. data/lib/javascriptmvc/documentjs/pair.js +302 -0
  52. data/lib/javascriptmvc/documentjs/prototype.js +13 -0
  53. data/lib/javascriptmvc/documentjs/scripts/build.js +6 -0
  54. data/lib/javascriptmvc/documentjs/static.js +25 -0
  55. data/lib/javascriptmvc/documentjs/test/docs/Something.json +1 -0
  56. data/lib/javascriptmvc/documentjs/test/docs/searchData.json +1 -0
  57. data/lib/javascriptmvc/documentjs/test/something.js +8 -0
  58. data/lib/javascriptmvc/documentjs/test/test.html +6 -0
  59. data/lib/javascriptmvc/documentjs/test_doc.html +1 -0
  60. data/lib/javascriptmvc/documentjs/update +5 -0
  61. data/lib/javascriptmvc/funcunit/README +17 -0
  62. data/lib/javascriptmvc/funcunit/autosuggest/auto_suggest.js +495 -0
  63. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.css +24 -0
  64. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.html +26 -0
  65. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.js +17 -0
  66. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest_test.js +14 -0
  67. data/lib/javascriptmvc/funcunit/autosuggest/funcunit.html +15 -0
  68. data/lib/javascriptmvc/funcunit/build.js +54 -0
  69. data/lib/javascriptmvc/funcunit/drivers/selenium.js +129 -0
  70. data/lib/javascriptmvc/funcunit/drivers/standard.js +169 -0
  71. data/lib/javascriptmvc/funcunit/envjs +13 -0
  72. data/lib/javascriptmvc/funcunit/envjs.bat +28 -0
  73. data/lib/javascriptmvc/funcunit/funcunit.html +20 -0
  74. data/lib/javascriptmvc/funcunit/funcunit.js +1509 -0
  75. data/lib/javascriptmvc/funcunit/java/selenium-java-client-driver.jar +0 -0
  76. data/lib/javascriptmvc/funcunit/java/selenium-server.jar +0 -0
  77. data/lib/javascriptmvc/funcunit/qunit.html +22 -0
  78. data/lib/javascriptmvc/funcunit/qunit/qunit.css +119 -0
  79. data/lib/javascriptmvc/funcunit/qunit/qunit.js +1124 -0
  80. data/lib/javascriptmvc/funcunit/qunit/rhino/rhino.js +24 -0
  81. data/lib/javascriptmvc/funcunit/qunit/test/qunit.html +18 -0
  82. data/lib/javascriptmvc/funcunit/qunit/test/test.js +7 -0
  83. data/lib/javascriptmvc/funcunit/resources/funcunit.js +31 -0
  84. data/lib/javascriptmvc/funcunit/resources/jquery.js +6378 -0
  85. data/lib/javascriptmvc/funcunit/resources/json.js +201 -0
  86. data/lib/javascriptmvc/funcunit/resources/selenium_start.js +43 -0
  87. data/lib/javascriptmvc/funcunit/scripts/run.js +36 -0
  88. data/lib/javascriptmvc/funcunit/scripts/test.js +55 -0
  89. data/lib/javascriptmvc/funcunit/settings.js +10 -0
  90. data/lib/javascriptmvc/funcunit/synthetic/browsers.js +151 -0
  91. data/lib/javascriptmvc/funcunit/synthetic/demo.html +150 -0
  92. data/lib/javascriptmvc/funcunit/synthetic/demo/record.js +254 -0
  93. data/lib/javascriptmvc/funcunit/synthetic/drag/drag.html +41 -0
  94. data/lib/javascriptmvc/funcunit/synthetic/drag/drag.js +268 -0
  95. data/lib/javascriptmvc/funcunit/synthetic/drag/qunit.html +20 -0
  96. data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/drag_test.js +195 -0
  97. data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/qunit.js +7 -0
  98. data/lib/javascriptmvc/funcunit/synthetic/key.js +832 -0
  99. data/lib/javascriptmvc/funcunit/synthetic/mouse.js +291 -0
  100. data/lib/javascriptmvc/funcunit/synthetic/qunit.html +22 -0
  101. data/lib/javascriptmvc/funcunit/synthetic/recorder.html +303 -0
  102. data/lib/javascriptmvc/funcunit/synthetic/synthetic.html +85 -0
  103. data/lib/javascriptmvc/funcunit/synthetic/synthetic.js +796 -0
  104. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/key_test.js +391 -0
  105. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/mouse_test.js +233 -0
  106. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/qunit.js +6 -0
  107. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/synthetic_test.js +91 -0
  108. data/lib/javascriptmvc/funcunit/synthetic/test/submit.html +29 -0
  109. data/lib/javascriptmvc/funcunit/synthetic/test/submitted.html +3 -0
  110. data/lib/javascriptmvc/funcunit/template.html +18 -0
  111. data/lib/javascriptmvc/funcunit/test/drag.html +63 -0
  112. data/lib/javascriptmvc/funcunit/test/funcunit/funcunit.js +3 -0
  113. data/lib/javascriptmvc/funcunit/test/funcunit/funcunit_test.js +87 -0
  114. data/lib/javascriptmvc/funcunit/test/funcunit/open_test.js +28 -0
  115. data/lib/javascriptmvc/funcunit/test/funcunit/protodrag_test.js +13 -0
  116. data/lib/javascriptmvc/funcunit/test/funcunit/syn_test.js +41 -0
  117. data/lib/javascriptmvc/funcunit/test/jquery.event.drag.js +801 -0
  118. data/lib/javascriptmvc/funcunit/test/jquery.event.drop.js +439 -0
  119. data/lib/javascriptmvc/funcunit/test/jquery.js +6360 -0
  120. data/lib/javascriptmvc/funcunit/test/myapp.html +103 -0
  121. data/lib/javascriptmvc/funcunit/test/myotherapp.html +15 -0
  122. data/lib/javascriptmvc/funcunit/test/protodrag/dragdrop.js +974 -0
  123. data/lib/javascriptmvc/funcunit/test/protodrag/effects.js +1123 -0
  124. data/lib/javascriptmvc/funcunit/test/protodrag/funcunit_test.js +20 -0
  125. data/lib/javascriptmvc/funcunit/test/protodrag/myapp.html +63 -0
  126. data/lib/javascriptmvc/funcunit/test/protodrag/prototype.js +4874 -0
  127. data/lib/javascriptmvc/funcunit/test/protodrag/scriptaculous.js +68 -0
  128. data/lib/javascriptmvc/funcunit/update +5 -0
  129. data/lib/javascriptmvc/jquery/README +24 -0
  130. data/lib/javascriptmvc/jquery/build.js +73 -0
  131. data/lib/javascriptmvc/jquery/class/class.html +109 -0
  132. data/lib/javascriptmvc/jquery/class/class.js +627 -0
  133. data/lib/javascriptmvc/jquery/class/qunit.html +15 -0
  134. data/lib/javascriptmvc/jquery/class/test/qunit/class_test.js +146 -0
  135. data/lib/javascriptmvc/jquery/class/test/qunit/qunit.js +5 -0
  136. data/lib/javascriptmvc/jquery/class/test/qunit/test.html +20 -0
  137. data/lib/javascriptmvc/jquery/controller/controller.html +89 -0
  138. data/lib/javascriptmvc/jquery/controller/controller.js +735 -0
  139. data/lib/javascriptmvc/jquery/controller/history/history.html +44 -0
  140. data/lib/javascriptmvc/jquery/controller/history/history.js +177 -0
  141. data/lib/javascriptmvc/jquery/controller/qunit.html +21 -0
  142. data/lib/javascriptmvc/jquery/controller/subscribe/funcunit.html +21 -0
  143. data/lib/javascriptmvc/jquery/controller/subscribe/scripts/compress.js +6 -0
  144. data/lib/javascriptmvc/jquery/controller/subscribe/scripts/docs.js +6 -0
  145. data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.html +56 -0
  146. data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.js +27 -0
  147. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/funcunit.js +3 -0
  148. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/run.js +10 -0
  149. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/subscribe_test.js +11 -0
  150. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.html +21 -0
  151. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.js +9 -0
  152. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/run.js +2 -0
  153. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/subscribe_test.js +4 -0
  154. data/lib/javascriptmvc/jquery/controller/test/qunit/controller_test.js +170 -0
  155. data/lib/javascriptmvc/jquery/controller/test/qunit/qunit.js +9 -0
  156. data/lib/javascriptmvc/jquery/controller/view/qunit.html +21 -0
  157. data/lib/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js +15 -0
  158. data/lib/javascriptmvc/jquery/controller/view/test/qunit/qunit.js +6 -0
  159. data/lib/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro +1 -0
  160. data/lib/javascriptmvc/jquery/controller/view/view.js +102 -0
  161. data/lib/javascriptmvc/jquery/dom/closest/closest.html +23 -0
  162. data/lib/javascriptmvc/jquery/dom/closest/closest.js +47 -0
  163. data/lib/javascriptmvc/jquery/dom/closest/funcunit.html +20 -0
  164. data/lib/javascriptmvc/jquery/dom/closest/qunit.html +22 -0
  165. data/lib/javascriptmvc/jquery/dom/closest/scripts/compress.js +3 -0
  166. data/lib/javascriptmvc/jquery/dom/closest/scripts/doc.js +4 -0
  167. data/lib/javascriptmvc/jquery/dom/closest/scripts/test.js +55 -0
  168. data/lib/javascriptmvc/jquery/dom/closest/settings.js +40 -0
  169. data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/funcunit.js +3 -0
  170. data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/tests/basic.js +11 -0
  171. data/lib/javascriptmvc/jquery/dom/closest/test/qunit/qunit.js +4 -0
  172. data/lib/javascriptmvc/jquery/dom/closest/test/qunit/tests/basic.js +4 -0
  173. data/lib/javascriptmvc/jquery/dom/compare/compare.html +88 -0
  174. data/lib/javascriptmvc/jquery/dom/compare/compare.js +67 -0
  175. data/lib/javascriptmvc/jquery/dom/compare/qunit.html +20 -0
  176. data/lib/javascriptmvc/jquery/dom/compare/test/qunit/compare_test.js +19 -0
  177. data/lib/javascriptmvc/jquery/dom/compare/test/qunit/qunit.js +5 -0
  178. data/lib/javascriptmvc/jquery/dom/cookie/cookie.html +25 -0
  179. data/lib/javascriptmvc/jquery/dom/cookie/cookie.js +119 -0
  180. data/lib/javascriptmvc/jquery/dom/cookie/scripts/compress.js +6 -0
  181. data/lib/javascriptmvc/jquery/dom/cookie/scripts/doc.js +6 -0
  182. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/cookie_test.js +11 -0
  183. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.html +21 -0
  184. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.js +3 -0
  185. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/run.js +10 -0
  186. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/cookie_test.js +4 -0
  187. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.html +21 -0
  188. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.js +9 -0
  189. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/run.js +2 -0
  190. data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.html +71 -0
  191. data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.js +120 -0
  192. data/lib/javascriptmvc/jquery/dom/cur_styles/qunit.html +22 -0
  193. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/curStyles.micro +3 -0
  194. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/cur_styles_test.js +22 -0
  195. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/outer.micro +0 -0
  196. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/qunit.js +4 -0
  197. data/lib/javascriptmvc/jquery/dom/dimensions/curstyles.html +22 -0
  198. data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.html +132 -0
  199. data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.js +140 -0
  200. data/lib/javascriptmvc/jquery/dom/dimensions/qunit.html +22 -0
  201. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro +3 -0
  202. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js +8 -0
  203. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro +0 -0
  204. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js +4 -0
  205. data/lib/javascriptmvc/jquery/dom/dom.js +7 -0
  206. data/lib/javascriptmvc/jquery/dom/fixture/fixture.html +143 -0
  207. data/lib/javascriptmvc/jquery/dom/fixture/fixture.js +521 -0
  208. data/lib/javascriptmvc/jquery/dom/fixture/fixtures/messages.html +31 -0
  209. data/lib/javascriptmvc/jquery/dom/fixture/fixtures/test.json +3 -0
  210. data/lib/javascriptmvc/jquery/dom/fixture/qunit.html +22 -0
  211. data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/fixture_test.js +50 -0
  212. data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/qunit.js +4 -0
  213. data/lib/javascriptmvc/jquery/dom/form_params/form_params.html +57 -0
  214. data/lib/javascriptmvc/jquery/dom/form_params/form_params.js +106 -0
  215. data/lib/javascriptmvc/jquery/dom/form_params/qunit.html +22 -0
  216. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro +27 -0
  217. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro +20 -0
  218. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js +43 -0
  219. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js +4 -0
  220. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro +8 -0
  221. data/lib/javascriptmvc/jquery/dom/within/within.js +67 -0
  222. data/lib/javascriptmvc/jquery/error/background.png +0 -0
  223. data/lib/javascriptmvc/jquery/error/error.html +31 -0
  224. data/lib/javascriptmvc/jquery/error/error.js +227 -0
  225. data/lib/javascriptmvc/jquery/error/setup.js +4 -0
  226. data/lib/javascriptmvc/jquery/error/test/test.html +23 -0
  227. data/lib/javascriptmvc/jquery/error/test/test.js +4 -0
  228. data/lib/javascriptmvc/jquery/event/default/compress.js +7 -0
  229. data/lib/javascriptmvc/jquery/event/default/default.html +85 -0
  230. data/lib/javascriptmvc/jquery/event/default/default.js +193 -0
  231. data/lib/javascriptmvc/jquery/event/default/defaultjquery.html +117 -0
  232. data/lib/javascriptmvc/jquery/event/default/qunit.html +22 -0
  233. data/lib/javascriptmvc/jquery/event/default/test/qunit/default_test.js +104 -0
  234. data/lib/javascriptmvc/jquery/event/default/test/qunit/html.micro +8 -0
  235. data/lib/javascriptmvc/jquery/event/default/test/qunit/qunit.js +6 -0
  236. data/lib/javascriptmvc/jquery/event/default/test/qunit/run.js +2 -0
  237. data/lib/javascriptmvc/jquery/event/destroyed/destroyed.html +24 -0
  238. data/lib/javascriptmvc/jquery/event/destroyed/destroyed.js +40 -0
  239. data/lib/javascriptmvc/jquery/event/destroyed/destroyed_menu.html +96 -0
  240. data/lib/javascriptmvc/jquery/event/destroyed/qunit.html +21 -0
  241. data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js +12 -0
  242. data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js +6 -0
  243. data/lib/javascriptmvc/jquery/event/drag/drag.html +105 -0
  244. data/lib/javascriptmvc/jquery/event/drag/drag.js +466 -0
  245. data/lib/javascriptmvc/jquery/event/drag/limit/limit.html +74 -0
  246. data/lib/javascriptmvc/jquery/event/drag/limit/limit.js +56 -0
  247. data/lib/javascriptmvc/jquery/event/drag/limit/scripts/compress.js +6 -0
  248. data/lib/javascriptmvc/jquery/event/drag/limit/scripts/doc.js +6 -0
  249. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.html +21 -0
  250. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.js +3 -0
  251. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/limit_test.js +11 -0
  252. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/run.js +10 -0
  253. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/limit_test.js +4 -0
  254. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.html +21 -0
  255. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.js +9 -0
  256. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/run.js +2 -0
  257. data/lib/javascriptmvc/jquery/event/drag/qunit.html +16 -0
  258. data/lib/javascriptmvc/jquery/event/drag/scroll/scroll.js +120 -0
  259. data/lib/javascriptmvc/jquery/event/drag/test/qunit/drag_test.js +130 -0
  260. data/lib/javascriptmvc/jquery/event/drag/test/qunit/qunit.js +4 -0
  261. data/lib/javascriptmvc/jquery/event/drop/drop.html +74 -0
  262. data/lib/javascriptmvc/jquery/event/drop/drop.js +301 -0
  263. data/lib/javascriptmvc/jquery/event/event.js +6 -0
  264. data/lib/javascriptmvc/jquery/event/hashchange/hashchange.js +245 -0
  265. data/lib/javascriptmvc/jquery/event/hover/compress.js +7 -0
  266. data/lib/javascriptmvc/jquery/event/hover/hover.html +56 -0
  267. data/lib/javascriptmvc/jquery/event/hover/hover.js +219 -0
  268. data/lib/javascriptmvc/jquery/event/hover/qunit.html +16 -0
  269. data/lib/javascriptmvc/jquery/event/hover/test/qunit/hover_test.js +55 -0
  270. data/lib/javascriptmvc/jquery/event/hover/test/qunit/qunit.js +4 -0
  271. data/lib/javascriptmvc/jquery/event/livehack/compress.js +7 -0
  272. data/lib/javascriptmvc/jquery/event/livehack/funcunit.html +21 -0
  273. data/lib/javascriptmvc/jquery/event/livehack/livehack.html +25 -0
  274. data/lib/javascriptmvc/jquery/event/livehack/livehack.js +167 -0
  275. data/lib/javascriptmvc/jquery/event/offline/funcunit.html +20 -0
  276. data/lib/javascriptmvc/jquery/event/offline/offline.html +26 -0
  277. data/lib/javascriptmvc/jquery/event/offline/offline.js +36 -0
  278. data/lib/javascriptmvc/jquery/event/offline/qunit.html +22 -0
  279. data/lib/javascriptmvc/jquery/event/offline/scripts/compress.js +3 -0
  280. data/lib/javascriptmvc/jquery/event/offline/scripts/doc.js +4 -0
  281. data/lib/javascriptmvc/jquery/event/offline/settings.js +41 -0
  282. data/lib/javascriptmvc/jquery/event/offline/test/funcunit/funcunit.js +3 -0
  283. data/lib/javascriptmvc/jquery/event/offline/test/funcunit/tests/basic.js +11 -0
  284. data/lib/javascriptmvc/jquery/event/offline/test/qunit/qunit.js +4 -0
  285. data/lib/javascriptmvc/jquery/event/offline/test/qunit/tests/basic.js +4 -0
  286. data/lib/javascriptmvc/jquery/event/resize/funcunit.html +20 -0
  287. data/lib/javascriptmvc/jquery/event/resize/qunit.html +22 -0
  288. data/lib/javascriptmvc/jquery/event/resize/resize.html +23 -0
  289. data/lib/javascriptmvc/jquery/event/resize/resize.js +50 -0
  290. data/lib/javascriptmvc/jquery/event/resize/scripts/compress.js +3 -0
  291. data/lib/javascriptmvc/jquery/event/resize/scripts/doc.js +4 -0
  292. data/lib/javascriptmvc/jquery/event/resize/scripts/test.js +55 -0
  293. data/lib/javascriptmvc/jquery/event/resize/settings.js +40 -0
  294. data/lib/javascriptmvc/jquery/event/resize/test/funcunit/funcunit.js +3 -0
  295. data/lib/javascriptmvc/jquery/event/resize/test/funcunit/tests/basic.js +11 -0
  296. data/lib/javascriptmvc/jquery/event/resize/test/qunit/qunit.js +4 -0
  297. data/lib/javascriptmvc/jquery/event/resize/test/qunit/tests/basic.js +4 -0
  298. data/lib/javascriptmvc/jquery/event/select/scripts/compress.js +6 -0
  299. data/lib/javascriptmvc/jquery/event/select/scripts/doc.js +6 -0
  300. data/lib/javascriptmvc/jquery/event/select/select.html +63 -0
  301. data/lib/javascriptmvc/jquery/event/select/select.js +65 -0
  302. data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.html +21 -0
  303. data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.js +3 -0
  304. data/lib/javascriptmvc/jquery/event/select/test/funcunit/run.js +10 -0
  305. data/lib/javascriptmvc/jquery/event/select/test/funcunit/select_test.js +11 -0
  306. data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.html +21 -0
  307. data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.js +5 -0
  308. data/lib/javascriptmvc/jquery/event/select/test/qunit/run.js +2 -0
  309. data/lib/javascriptmvc/jquery/event/select/test/qunit/select_test.js +4 -0
  310. data/lib/javascriptmvc/jquery/generate/app +23 -0
  311. data/lib/javascriptmvc/jquery/generate/controller +21 -0
  312. data/lib/javascriptmvc/jquery/generate/model +26 -0
  313. data/lib/javascriptmvc/jquery/generate/page +20 -0
  314. data/lib/javascriptmvc/jquery/generate/plugin +20 -0
  315. data/lib/javascriptmvc/jquery/generate/scaffold +23 -0
  316. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).css.ejs +4 -0
  317. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).html.ejs +23 -0
  318. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).js.ejs +21 -0
  319. data/lib/javascriptmvc/jquery/generate/templates/app/controllers/.ignore +0 -0
  320. data/lib/javascriptmvc/jquery/generate/templates/app/docs/.ignore +0 -0
  321. data/lib/javascriptmvc/jquery/generate/templates/app/fixtures/.ignore +0 -0
  322. data/lib/javascriptmvc/jquery/generate/templates/app/funcunit.html.ejs +15 -0
  323. data/lib/javascriptmvc/jquery/generate/templates/app/models/.ignore +0 -0
  324. data/lib/javascriptmvc/jquery/generate/templates/app/qunit.html.ejs +20 -0
  325. data/lib/javascriptmvc/jquery/generate/templates/app/resources/.ignore +0 -0
  326. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/build.js.ejs +6 -0
  327. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/clean.js.ejs +6 -0
  328. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/docs.js.ejs +4 -0
  329. data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/(application_name)_test.js.ejs +9 -0
  330. data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/funcunit.js.ejs +3 -0
  331. data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/(application_name)_test.js.ejs +5 -0
  332. data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/qunit.js.ejs +3 -0
  333. data/lib/javascriptmvc/jquery/generate/templates/app/views/.ignore +0 -0
  334. data/lib/javascriptmvc/jquery/generate/templates/controller/controllers/(underscore)_controller.js.ejs +12 -0
  335. data/lib/javascriptmvc/jquery/generate/templates/model/fixtures.link +1 -0
  336. data/lib/javascriptmvc/jquery/generate/templates/model/models.link +1 -0
  337. data/lib/javascriptmvc/jquery/generate/templates/model/test/qunit.link +1 -0
  338. data/lib/javascriptmvc/jquery/generate/templates/page.ejs +23 -0
  339. data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).html.ejs +23 -0
  340. data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).js.ejs +3 -0
  341. data/lib/javascriptmvc/jquery/generate/templates/plugin/fixtures/.ignore +0 -0
  342. data/lib/javascriptmvc/jquery/generate/templates/plugin/funcunit.html.ejs +15 -0
  343. data/lib/javascriptmvc/jquery/generate/templates/plugin/qunit.html.ejs +20 -0
  344. data/lib/javascriptmvc/jquery/generate/templates/plugin/resources/.ignore +0 -0
  345. data/lib/javascriptmvc/jquery/generate/templates/plugin/scripts.link +1 -0
  346. data/lib/javascriptmvc/jquery/generate/templates/plugin/test.link +1 -0
  347. data/lib/javascriptmvc/jquery/generate/templates/plugin/views/.ignore +0 -0
  348. data/lib/javascriptmvc/jquery/generate/templates/scaffold/controllers/(underscore)_controller.js.ejs +96 -0
  349. data/lib/javascriptmvc/jquery/generate/templates/scaffold/fixtures/(plural).json.get.ejs +3 -0
  350. data/lib/javascriptmvc/jquery/generate/templates/scaffold/models/(underscore).js.ejs +83 -0
  351. data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/funcunit/(underscore)_controller_test.js.ejs +63 -0
  352. data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/qunit/(underscore)_test.js.ejs +45 -0
  353. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/edit.ejs.ejs +10 -0
  354. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/init.ejs.ejs +26 -0
  355. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/list.ejs.ejs +5 -0
  356. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/show.ejs.ejs +10 -0
  357. data/lib/javascriptmvc/jquery/jquery.js +6360 -0
  358. data/lib/javascriptmvc/jquery/lang/json/json.html +25 -0
  359. data/lib/javascriptmvc/jquery/lang/json/json.js +201 -0
  360. data/lib/javascriptmvc/jquery/lang/json/scripts/compress.js +6 -0
  361. data/lib/javascriptmvc/jquery/lang/json/scripts/doc.js +6 -0
  362. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.html +21 -0
  363. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.js +3 -0
  364. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/json_test.js +11 -0
  365. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/run.js +10 -0
  366. data/lib/javascriptmvc/jquery/lang/json/test/qunit/json_test.js +4 -0
  367. data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.html +21 -0
  368. data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.js +9 -0
  369. data/lib/javascriptmvc/jquery/lang/json/test/qunit/run.js +2 -0
  370. data/lib/javascriptmvc/jquery/lang/lang.html +27 -0
  371. data/lib/javascriptmvc/jquery/lang/lang.js +104 -0
  372. data/lib/javascriptmvc/jquery/lang/openajax/openajax.js +202 -0
  373. data/lib/javascriptmvc/jquery/lang/rsplit/rsplit.js +31 -0
  374. data/lib/javascriptmvc/jquery/lang/vector/vector.js +167 -0
  375. data/lib/javascriptmvc/jquery/model/associations/associations.html +25 -0
  376. data/lib/javascriptmvc/jquery/model/associations/associations.js +46 -0
  377. data/lib/javascriptmvc/jquery/model/associations/qunit.html +21 -0
  378. data/lib/javascriptmvc/jquery/model/associations/test/qunit/associations_test.js +51 -0
  379. data/lib/javascriptmvc/jquery/model/associations/test/qunit/qunit.js +9 -0
  380. data/lib/javascriptmvc/jquery/model/associations/test/qunit/run.js +2 -0
  381. data/lib/javascriptmvc/jquery/model/backup/backup.js +82 -0
  382. data/lib/javascriptmvc/jquery/model/json_rest/json_rest.js +91 -0
  383. data/lib/javascriptmvc/jquery/model/list/list.js +148 -0
  384. data/lib/javascriptmvc/jquery/model/list/qunit.html +16 -0
  385. data/lib/javascriptmvc/jquery/model/list/test/qunit/list_test.js +58 -0
  386. data/lib/javascriptmvc/jquery/model/list/test/qunit/qunit.js +6 -0
  387. data/lib/javascriptmvc/jquery/model/list/test/qunit/run.js +0 -0
  388. data/lib/javascriptmvc/jquery/model/model.js +537 -0
  389. data/lib/javascriptmvc/jquery/model/qunit.html +17 -0
  390. data/lib/javascriptmvc/jquery/model/store/store.js +66 -0
  391. data/lib/javascriptmvc/jquery/model/test/qunit/model_test.js +71 -0
  392. data/lib/javascriptmvc/jquery/model/test/qunit/qunit.js +5 -0
  393. data/lib/javascriptmvc/jquery/qunit.html +15 -0
  394. data/lib/javascriptmvc/jquery/test/funcunit/funcunit.html +21 -0
  395. data/lib/javascriptmvc/jquery/test/funcunit/funcunit.js +3 -0
  396. data/lib/javascriptmvc/jquery/test/funcunit/jquerytest_test.js +11 -0
  397. data/lib/javascriptmvc/jquery/test/funcunit/run.js +10 -0
  398. data/lib/javascriptmvc/jquery/test/qunit/qunit.js +22 -0
  399. data/lib/javascriptmvc/jquery/update +5 -0
  400. data/lib/javascriptmvc/jquery/view/compress.js +7 -0
  401. data/lib/javascriptmvc/jquery/view/ejs/ejs.html +25 -0
  402. data/lib/javascriptmvc/jquery/view/ejs/ejs.js +489 -0
  403. data/lib/javascriptmvc/jquery/view/ejs/funcunit.html +21 -0
  404. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/ejs_test.js +11 -0
  405. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/funcunit.js +3 -0
  406. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/run.js +10 -0
  407. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/ejs_test.js +4 -0
  408. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.html +21 -0
  409. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.js +9 -0
  410. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/run.js +2 -0
  411. data/lib/javascriptmvc/jquery/view/fulljslint.js +3774 -0
  412. data/lib/javascriptmvc/jquery/view/helpers/helpers.js +338 -0
  413. data/lib/javascriptmvc/jquery/view/jaml/compress.js +7 -0
  414. data/lib/javascriptmvc/jquery/view/jaml/funcunit.html +21 -0
  415. data/lib/javascriptmvc/jquery/view/jaml/jaml.html +25 -0
  416. data/lib/javascriptmvc/jquery/view/jaml/jaml.js +73 -0
  417. data/lib/javascriptmvc/jquery/view/jaml/node.js +149 -0
  418. data/lib/javascriptmvc/jquery/view/jaml/template.js +131 -0
  419. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/funcunit.js +3 -0
  420. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/jaml_test.js +11 -0
  421. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/run.js +10 -0
  422. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/jaml_test.js +4 -0
  423. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.html +21 -0
  424. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.js +9 -0
  425. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/run.js +2 -0
  426. data/lib/javascriptmvc/jquery/view/micro/compress.js +7 -0
  427. data/lib/javascriptmvc/jquery/view/micro/funcunit.html +21 -0
  428. data/lib/javascriptmvc/jquery/view/micro/micro.html +25 -0
  429. data/lib/javascriptmvc/jquery/view/micro/micro.js +57 -0
  430. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/funcunit.js +3 -0
  431. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/micro_test.js +11 -0
  432. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/run.js +10 -0
  433. data/lib/javascriptmvc/jquery/view/micro/test/qunit/micro_test.js +4 -0
  434. data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.html +21 -0
  435. data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.js +9 -0
  436. data/lib/javascriptmvc/jquery/view/micro/test/qunit/run.js +2 -0
  437. data/lib/javascriptmvc/jquery/view/qunit.html +16 -0
  438. data/lib/javascriptmvc/jquery/view/test/compression/compression.html +12 -0
  439. data/lib/javascriptmvc/jquery/view/test/compression/compression.js +11 -0
  440. data/lib/javascriptmvc/jquery/view/test/compression/run.js +36 -0
  441. data/lib/javascriptmvc/jquery/view/test/funcunit/funcunit.js +3 -0
  442. data/lib/javascriptmvc/jquery/view/test/funcunit/run.js +10 -0
  443. data/lib/javascriptmvc/jquery/view/test/funcunit/view_test.js +11 -0
  444. data/lib/javascriptmvc/jquery/view/test/qunit/nested_plugin.ejs +1 -0
  445. data/lib/javascriptmvc/jquery/view/test/qunit/plugin.ejs +1 -0
  446. data/lib/javascriptmvc/jquery/view/test/qunit/qunit.js +9 -0
  447. data/lib/javascriptmvc/jquery/view/test/qunit/template.ejs +1 -0
  448. data/lib/javascriptmvc/jquery/view/test/qunit/template.jaml +3 -0
  449. data/lib/javascriptmvc/jquery/view/test/qunit/template.micro +1 -0
  450. data/lib/javascriptmvc/jquery/view/test/qunit/template.tmpl +1 -0
  451. data/lib/javascriptmvc/jquery/view/test/qunit/view_test.js +24 -0
  452. data/lib/javascriptmvc/jquery/view/tmpl/tmpl.js +150 -0
  453. data/lib/javascriptmvc/jquery/view/view.html +65 -0
  454. data/lib/javascriptmvc/jquery/view/view.js +296 -0
  455. data/lib/javascriptmvc/js +56 -0
  456. data/lib/javascriptmvc/js.bat +57 -0
  457. data/lib/javascriptmvc/steal/README +26 -0
  458. data/lib/javascriptmvc/steal/build/apps/apps.js +208 -0
  459. data/lib/javascriptmvc/steal/build/apps/test.js +4 -0
  460. data/lib/javascriptmvc/steal/build/build.js +281 -0
  461. data/lib/javascriptmvc/steal/build/pluginify.js +73 -0
  462. data/lib/javascriptmvc/steal/build/scripts/compiler.jar +0 -0
  463. data/lib/javascriptmvc/steal/build/scripts/scripts.js +155 -0
  464. data/lib/javascriptmvc/steal/build/styles/cssmin.js +17 -0
  465. data/lib/javascriptmvc/steal/build/styles/styles.js +84 -0
  466. data/lib/javascriptmvc/steal/build/test/basicpage.html +6 -0
  467. data/lib/javascriptmvc/steal/build/test/basicproduction.js +1 -0
  468. data/lib/javascriptmvc/steal/build/test/basicsource.js +6 -0
  469. data/lib/javascriptmvc/steal/build/test/css/css/css1.css +1 -0
  470. data/lib/javascriptmvc/steal/build/test/css/css/justin.png +0 -0
  471. data/lib/javascriptmvc/steal/build/test/css/css2.css +5 -0
  472. data/lib/javascriptmvc/steal/build/test/css/page.html +9 -0
  473. data/lib/javascriptmvc/steal/build/test/css/production.css +1 -0
  474. data/lib/javascriptmvc/steal/build/test/css/test.js +7 -0
  475. data/lib/javascriptmvc/steal/build/test/css/upload.PNG +0 -0
  476. data/lib/javascriptmvc/steal/build/test/foreign.html +6 -0
  477. data/lib/javascriptmvc/steal/build/test/foreign.js +2 -0
  478. data/lib/javascriptmvc/steal/build/test/removecode.js +11 -0
  479. data/lib/javascriptmvc/steal/build/test/run.js +57 -0
  480. data/lib/javascriptmvc/steal/build/test/stealpage.html +10 -0
  481. data/lib/javascriptmvc/steal/build/test/stealprodpage.html +10 -0
  482. data/lib/javascriptmvc/steal/build/test/test.js +3 -0
  483. data/lib/javascriptmvc/steal/buildjs +21 -0
  484. data/lib/javascriptmvc/steal/clean/beautify.js +1108 -0
  485. data/lib/javascriptmvc/steal/clean/clean.js +179 -0
  486. data/lib/javascriptmvc/steal/clean/jslint.js +5662 -0
  487. data/lib/javascriptmvc/steal/clean/test.js +7 -0
  488. data/lib/javascriptmvc/steal/cleanjs +5 -0
  489. data/lib/javascriptmvc/steal/coffee/coffee-script.js +9 -0
  490. data/lib/javascriptmvc/steal/coffee/coffee.js +56 -0
  491. data/lib/javascriptmvc/steal/dev/dev.js +83 -0
  492. data/lib/javascriptmvc/steal/end.js +1 -0
  493. data/lib/javascriptmvc/steal/generate/app +23 -0
  494. data/lib/javascriptmvc/steal/generate/ejs.js +470 -0
  495. data/lib/javascriptmvc/steal/generate/generate.js +211 -0
  496. data/lib/javascriptmvc/steal/generate/inflector.js +117 -0
  497. data/lib/javascriptmvc/steal/generate/system.js +33 -0
  498. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).css.ejs +10 -0
  499. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).html.ejs +18 -0
  500. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).js.ejs +10 -0
  501. data/lib/javascriptmvc/steal/generate/templates/app/docs/.ignore +0 -0
  502. data/lib/javascriptmvc/steal/generate/templates/app/resources/.ignore +0 -0
  503. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.coffee.ejs +5 -0
  504. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.js.ejs +13 -0
  505. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.less.ejs +9 -0
  506. data/lib/javascriptmvc/steal/generate/templates/app/scripts/build.js.ejs +6 -0
  507. data/lib/javascriptmvc/steal/generate/templates/app/scripts/clean.js.ejs +6 -0
  508. data/lib/javascriptmvc/steal/generate/templates/app/test/.ignore +0 -0
  509. data/lib/javascriptmvc/steal/generate/templates/page.ejs +23 -0
  510. data/lib/javascriptmvc/steal/generate/test/test.js +92 -0
  511. data/lib/javascriptmvc/steal/get/get.js +163 -0
  512. data/lib/javascriptmvc/steal/get/gets.json +10 -0
  513. data/lib/javascriptmvc/steal/get/getter.js +115 -0
  514. data/lib/javascriptmvc/steal/get/github.js +134 -0
  515. data/lib/javascriptmvc/steal/get/json.js +172 -0
  516. data/lib/javascriptmvc/steal/getjs +5 -0
  517. data/lib/javascriptmvc/steal/js +56 -0
  518. data/lib/javascriptmvc/steal/js.bat +57 -0
  519. data/lib/javascriptmvc/steal/less/less.js +117 -0
  520. data/lib/javascriptmvc/steal/less/less_engine.js +2529 -0
  521. data/lib/javascriptmvc/steal/rhino/blank.html +6 -0
  522. data/lib/javascriptmvc/steal/rhino/build.js +31 -0
  523. data/lib/javascriptmvc/steal/rhino/docs.js +68 -0
  524. data/lib/javascriptmvc/steal/rhino/empty.html +12 -0
  525. data/lib/javascriptmvc/steal/rhino/env.js +11537 -0
  526. data/lib/javascriptmvc/steal/rhino/file.js +299 -0
  527. data/lib/javascriptmvc/steal/rhino/js.jar +0 -0
  528. data/lib/javascriptmvc/steal/rhino/loader.js +8 -0
  529. data/lib/javascriptmvc/steal/rhino/prompt.js +49 -0
  530. data/lib/javascriptmvc/steal/rhino/steal.js +122 -0
  531. data/lib/javascriptmvc/steal/rhino/test.js +16 -0
  532. data/lib/javascriptmvc/steal/steal.js +1317 -0
  533. data/lib/javascriptmvc/steal/steal.production.js +23 -0
  534. data/lib/javascriptmvc/steal/test/absoluteurl.html +7 -0
  535. data/lib/javascriptmvc/steal/test/absoluteurl/absoluteurl.js +1 -0
  536. data/lib/javascriptmvc/steal/test/absoluteurl/alert.js +1 -0
  537. data/lib/javascriptmvc/steal/test/another/two.js +2 -0
  538. data/lib/javascriptmvc/steal/test/one/four.js +1 -0
  539. data/lib/javascriptmvc/steal/test/one/one.js +6 -0
  540. data/lib/javascriptmvc/steal/test/qunit/qunit.html +22 -0
  541. data/lib/javascriptmvc/steal/test/qunit/qunit.js +3 -0
  542. data/lib/javascriptmvc/steal/test/qunit/steal_test.js +197 -0
  543. data/lib/javascriptmvc/steal/test/run.js +12 -0
  544. data/lib/javascriptmvc/steal/test/steal.html +37 -0
  545. data/lib/javascriptmvc/steal/test/test.js +82 -0
  546. data/lib/javascriptmvc/steal/test/three.js +3 -0
  547. data/lib/javascriptmvc/steal/testing/test.html +20 -0
  548. data/lib/javascriptmvc/steal/testing/testing.js +48 -0
  549. data/lib/javascriptmvc/steal/update +5 -0
  550. metadata +622 -0
@@ -0,0 +1,13 @@
1
+ #!/bin/sh
2
+
3
+ CP=selenium/selenium-java-client-driver.jar:selenium/js.jar
4
+ ARGS=[
5
+ for arg
6
+ do
7
+ if [ $arg != $0 ]
8
+ then
9
+ ARGS=$ARGS"'$arg'",
10
+ fi
11
+ done
12
+ ARGS=$ARGS]
13
+ java -Xss1024k -cp $CP org.mozilla.javascript.tools.shell.Main -e _args=$ARGS -opt -1 -e 'load('"'"selenium/run.js"'"')'
@@ -0,0 +1,28 @@
1
+ @echo off
2
+
3
+ SETLOCAL ENABLEDELAYEDEXPANSION
4
+
5
+ set BASE=%0
6
+
7
+ set BASE=%BASE:envjs=%
8
+
9
+ if not "%BASE%" == "" ( set BASE=%BASE:\=/% )
10
+
11
+ :: trim spaces
12
+ for /f "tokens=1*" %%A in ("%BASE%") do SET BASE=%%A
13
+
14
+ SET CP=%BASE%java/selenium-java-client-driver.jar;%BASE%../steal/rhino/js.jar
15
+
16
+ SET ARGS=[
17
+
18
+ for /f "tokens=1,2,3,4,5,6 delims= " %%a in ("%*") do SET ARGS=!ARGS!'%%a','%%b','%%c','%%d','%%e','%%f'
19
+
20
+ for %%a in (",''=") do ( call set ARGS=%%ARGS:%%~a%% )
21
+
22
+ for /f "tokens=1*" %%A in ("%ARGS%") do SET ARGS=%%A
23
+
24
+ SET ARGS=%ARGS%,'%BASE%']
25
+
26
+ set ARGS=%ARGS:\=/%
27
+
28
+ java -Xss1024k -cp %CP% org.mozilla.javascript.tools.shell.Main -opt -1 -e _args=%ARGS% -e load('%BASE%scripts/run.js')
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" type="text/css" href="../funcunit/qunit/qunit.css" />
4
+ <title>FuncUnit Test</title>
5
+ <style>
6
+ body {
7
+ margin: 0px; padding: 0px;
8
+ }
9
+ </style>
10
+ </head>
11
+ <body>
12
+
13
+ <h1 id="qunit-header">funcunit Test Suite</h1>
14
+ <h2 id="qunit-banner"></h2>
15
+ <div id="qunit-testrunner-toolbar"></div>
16
+ <h2 id="qunit-userAgent"></h2>
17
+ <ol id="qunit-tests"></ol>
18
+ <script type='text/javascript' src='../steal/steal.js?steal[app]=funcunit/test/funcunit'></script>
19
+ </body>
20
+ </html>
@@ -0,0 +1,1509 @@
1
+ //what we need from javascriptmvc or other places
2
+ steal.plugins('funcunit/qunit',
3
+ 'funcunit/qunit/rhino')
4
+ .then('resources/jquery','resources/json')
5
+ .plugins('funcunit/synthetic')
6
+ //Now describe FuncUnit
7
+ .then(function(){
8
+
9
+
10
+
11
+ //this gets the global object, even in rhino
12
+ var window = (function(){return this }).call(null),
13
+
14
+ //if there is an old FuncUnit, use that for settings
15
+ oldFunc = window.FuncUnit;
16
+
17
+ /**
18
+ * @constructor FuncUnit
19
+ * @tag core
20
+ * @test test.html
21
+ * @download http://github.com/downloads/jupiterjs/funcunit/funcunit-beta-4.zip
22
+ * FuncUnit provides powerful functional testing as an add on to [http://docs.jquery.com/QUnit QUnit].
23
+ * The same tests can be run
24
+ * in the browser, or with Selenium. It also lets you automate basic
25
+ * QUnit tests in [http://www.envjs.com/ EnvJS] (a command line browser).
26
+ *
27
+ * <h2>Example:</h2>
28
+ * The following tests that an AutoSuggest returns 5 results.
29
+ * <a href='funcunit/autosuggest/funcunit.html'>See it in action!</a> (Make sure
30
+ * you turn off your popup blocker!).
31
+ @codestart
32
+ module("autosuggest",{
33
+ setup: function() {
34
+ S.open('autosuggest.html')
35
+ }
36
+ });
37
+
38
+ test("JavaScript results",function(){
39
+ S('input').click().type("JavaScript")
40
+
41
+ // wait until we have some results
42
+ S('.autocomplete_item').visible(function(){
43
+ equal( S('.autocomplete_item').size(), 5, "there are 5 results")
44
+ })
45
+ });
46
+ @codeend
47
+ *
48
+ * <h2>Basic Setup</h2>
49
+ * <h3>Setup with JavaScriptMVC</h3>
50
+ * If you're setting up FuncUnit with JavaScriptMVC,
51
+ * use [steal.static.plugins] to get the funcunit plugin. If you used
52
+ * JavaScriptMVC's generators, it will setup a testing skeleton for you.
53
+ * <h3>Setup with Stand-alone funcunit.js</h3>
54
+ * Lets say you want to test <code>pages/mypage.html</code> and
55
+ * you've installed funcunit in test/funcunit.</br>
56
+ * Steps:
57
+ * <ol>
58
+ * <li>Create a HTML file (pages/mypage_test.html) that loads
59
+ * <code><b>qunit.css</b></code>, <code><b>funcunit.js</b></code>,
60
+ * and <code><b>mypage_test.js</b></code>. We'll create mypage_test.js in step #2.
61
+ @codestart html
62
+ &lt;html>
63
+ &lt;head>
64
+ &lt;link href='../funcunit/<b>qunit.css</b>'
65
+ type='text/css'
66
+ rel='stylesheet' />
67
+ &lt;script src='../funcunit/<b>funcunit.js</b>'
68
+ type='text/javascript' ></script>
69
+ &lt;script src='<b>mypage_test.js</b>'
70
+ type='text/javascript'></script>
71
+ &lt;title>MyPage Test Suite&lt;/title>
72
+ &lt;/head>
73
+ &lt;body>
74
+ &lt;h1 id="qunit-header">MyPage Test Suite&lt;/h1>
75
+ &lt;h2 id="qunit-banner">&lt;/h2>
76
+ &lt;div id="qunit-testrunner-toolbar">&lt;/div>
77
+ &lt;h2 id="qunit-userAgent">&lt;/h2>
78
+ &lt;ol id="qunit-tests">&lt;/ol>
79
+ &lt;/body>
80
+ &lt;/html>
81
+ @codeend
82
+ * </li>
83
+ * <li>Create a JS file (<code>pages/mypage_test.js</code>) for your tests. The skeleton should like:
84
+ @codestart
85
+ module("APPNAME", {
86
+ setup: function() {
87
+ // opens the page you want to test
88
+ $.open("myPage.html");
89
+ }
90
+ })
91
+
92
+ test("page has content", function(){
93
+ ok( S("body *").size(), "There be elements in that there body")
94
+ })
95
+ @codeend
96
+ * </li>
97
+ * <li>Open your html page (<code>mytest.html</code>) in a browser. Did it pass?
98
+ * If not check the paths.
99
+ * <div class='whisper'>P.S. Your page and test files don't have to be in the same folder; however,
100
+ * on the filesystem, Firefox and Chrome don't let you access parent folders. We wanted the
101
+ * demo to work without having to host these files.
102
+ * </div>
103
+ *
104
+ * </li>
105
+ * <li>Now run your test in Selenium. In windows:
106
+ @codestart text
107
+ > envjs ../../pages/mypage_test.html
108
+ @codeend
109
+ In Linux / Mac:
110
+ @codestart text
111
+ > ./envjs ../../pages/mypage_test.html
112
+ @codeend
113
+ <div class='whisper'>This will run mytest.html on the filesystem. To run it served, just
114
+ pass in the url of your test page: <pre>envjs http://localhost/pages/mypage_test.html</pre>.
115
+ </div>
116
+ </li>
117
+ * </ol>
118
+ * <h2>Writing Tests</h2>
119
+ * <p>Writing tests is super easy and follows this pattern:</p>
120
+ <ol>
121
+ <li>Open a page with [FuncUnit.static.open S.open].
122
+ @codestart
123
+ S.open("//myapp/myapp.html")
124
+ @codeend
125
+ </li>
126
+ <li>Do some things
127
+ @codestart
128
+ //click something
129
+ S('#myButton').click()
130
+
131
+ //type something
132
+ S('#myInput').type("hello")
133
+ @codeend
134
+ </li>
135
+
136
+ <li>Wait for the page to change:
137
+ @codestart
138
+ //Wait until it is visible
139
+ S('#myMenu').visible()
140
+
141
+ //wait until something exists
142
+ S('#myArea').exists()
143
+
144
+ //waits a second
145
+ S.wait(1000);
146
+ @codeend
147
+ </li>
148
+ <li>Check your page in a callback:
149
+ @codestart
150
+ S('#myMenu').visible(function(){
151
+ //check that offset is right
152
+ equals(S('#myMenu').offset().left,
153
+ 500,
154
+ "menu is in the right spot");
155
+
156
+ })
157
+ @codeend
158
+ </li>
159
+ </ol>
160
+ <h2>Actions, Waits, and Getters</h2>
161
+ <p>FuncUnit supports three types of commands: asynchronous actions and waits,
162
+ and synchronous getters.</p>
163
+ <p><b>Actions</b> are used to simulate user behavior such as clicking, typing, moving the mouse.</p>
164
+ <p><b>Waits</b> are used to pause the test script until a condition has been met.</p>
165
+ <p><b>Getters</b> are used to get information about elements in the page</p>
166
+ <p>Typically, a test looks like a series of action and wait commands followed by qUnit test of
167
+ the result of a getter command. Getter commands are almost always in a action or wait callback.</p>
168
+ <h3>Actions</h3>
169
+ Actions simulate user behavior. FuncUnit provides the following actions:
170
+ <ul>
171
+ <li><code>[FuncUnit.static.open open]</code> - Opens a page.</li>
172
+
173
+ <li><code>[FuncUnit.prototype.click click]</code> - clicks an element (mousedown, mouseup, click).</li>
174
+ <li><code>[FuncUnit.prototype.dblclick dblclick]</code> - two clicks followed by a dblclick.</li>
175
+ <li><code>[FuncUnit.prototype.rightClick rightClick]</code> - a right mousedown, mouseup, and contextmenu.</li>
176
+
177
+ <li><code>[FuncUnit.prototype.type type]</code> - Types characters into an element.</li>
178
+
179
+ <li><code>[FuncUnit.prototype.move move]</code> - mousemove, mouseover, and mouseouts from one element to another.</li>
180
+ <li><code>[FuncUnit.prototype.drag drag]</code> - a drag motion from one element to another.</li>
181
+
182
+ <li><code>[FuncUnit.prototype.scroll scroll]</code> - scrolls an element.</li>
183
+ </ul>
184
+
185
+ <p>Actions run asynchronously, meaning they do not complete all their events immediately.
186
+ However, each action is queued so that you can write actions (and waits) linearly.</p>
187
+ <p>The following might simulate typing and resizing a "resizable" textarea plugin:</p>
188
+ @codestart
189
+ S.open('resizableTextarea.html');
190
+
191
+ S('textarea').click().type("Hello World");
192
+
193
+ S('.resizer').drag("+20 +20");
194
+ @codeend
195
+ <h3>Getters</h3>
196
+ Getters are used to test the conditions of the page. Most getter commands correspond to a jQuery
197
+ method of the same name. The following getters are provided:
198
+ <table style='font-family: monospace'>
199
+ <tr>
200
+ <th colspan='2'>Dimensions</th> <th>Attributes</th> <th>Position</th> <th>Selector</th> <th>Style</th>
201
+ </tr>
202
+ <tr>
203
+ <td>[FuncUnit.prototype.width width]</td>
204
+ <td>[FuncUnit.prototype.height height]</td>
205
+ <td>[FuncUnit.prototype.attr attr]</td>
206
+ <td>[FuncUnit.prototype.position position]</td>
207
+ <td>[FuncUnit.prototype.size size]</td>
208
+ <td>[FuncUnit.prototype.css css]</td>
209
+ </tr>
210
+ <tr>
211
+ <td>[FuncUnit.prototype.innerWidth innerWidth]</td>
212
+ <td>[FuncUnit.prototype.innerHeight innerHeight]</td>
213
+ <td>[FuncUnit.prototype.hasClass hasClass]</td>
214
+ <td>[FuncUnit.prototype.offset offset]</td>
215
+ <td>[FuncUnit.prototype.exists exists]</td>
216
+ <td>[FuncUnit.prototype.visible visible]</td>
217
+ </tr>
218
+ <tr>
219
+ <td>[FuncUnit.prototype.outerWidth outerWidth]</td>
220
+ <td>[FuncUnit.prototype.outerHeight outerHeight]</td>
221
+ <td>[FuncUnit.prototype.val val]</td>
222
+ <td>[FuncUnit.prototype.scrollLeft scrollLeft]</td>
223
+ <td>[FuncUnit.prototype.missing missing]</td>
224
+ <td>[FuncUnit.prototype.invisible invisible]</td>
225
+ </tr>
226
+ <tr>
227
+ <td colspan='2'></td>
228
+ <td>[FuncUnit.prototype.text text]</td>
229
+ <td>[FuncUnit.prototype.scrollTop scrollTop]</td>
230
+ </tr>
231
+ <tr>
232
+ <td colspan='2'></td>
233
+ <td>[FuncUnit.prototype.html html]</td>
234
+ </tr>
235
+ </table>
236
+ <p>
237
+ As getters return synchronously, it's important that they happen after the action or wait command completes.
238
+ This is why getters are typically found in an action or wait command's callback:
239
+ </p>
240
+ The following checks that the textarea is 20 pixels taller after the drag.
241
+ @codestart
242
+ //save textarea reference
243
+ var txtarea = S('textarea'),
244
+
245
+ // save references to width and height
246
+ startingWidth = txtarea.width(),
247
+ startingHeight = txtarea.height();
248
+
249
+ S.open('resizableTextarea.html');
250
+
251
+ S('textarea').click().type("Hello World");
252
+
253
+ S('.resizer').drag("+20 +20", function(){
254
+ equals(txtarea.width(),
255
+ startingWidth,
256
+ "width stays the same");
257
+
258
+ equals(txtarea.height(),
259
+ startingHeight+20,
260
+ "height got bigger");
261
+ });
262
+ @codeend
263
+ <h3>Waits</h3>
264
+ <p>Waits are used to wait for a specific condition to be met before continuing to the next wait or
265
+ action command. Every getter commands can become a wait command when given a check value or function.
266
+ For
267
+ example, the following waits until the width of an element is 200 pixels and tests its offset.
268
+ </p>
269
+ @codestart
270
+ var sm = S("#sliderMenu");
271
+ sm.width( 200, function(){
272
+
273
+ var offset = sm.offset();
274
+ equals( offset.left, 200)
275
+ equals( offset.top, 200)
276
+ })
277
+ @codeend
278
+ <p>You can also provide a test function that when true, continues to the next action or wait command.
279
+ The following is equivalent to the previous example:
280
+ </p>
281
+ @codestart
282
+ var sm = S("#sliderMenu");
283
+
284
+ sm.width(
285
+ function( width ) {
286
+ return width == 200;
287
+ },
288
+ function(){
289
+ var offset = sm.offset();
290
+ equals( offset.left, 200)
291
+ equals( offset.top, 200)
292
+ }
293
+ )
294
+ @codeend
295
+ <div class='whisper'>Notice that the test function is provided the width of the element to use to check.</div>
296
+ <p>In addition to all the getter functions, FuncUnit provides:
297
+ </p>
298
+ <ul>
299
+ <li>[FuncUnit.static.wait S.wait] - waits a timeout before continuing.</li>
300
+ <li>[FuncUnit.prototype.wait S().wait] - waits a timeout before continuing.</li>
301
+ <li>[FuncUnit S(function(){})] - code runs between actions (like a wait with timeout = 0).</li>
302
+ </ul>
303
+ <h2>Automated Testing with Selenium</h2>
304
+ <p>FuncUnit has a command line mode, which allows you to run your tests as part of a checkin script or nightly build.
305
+ The Selenium server is used to automate opening browsers, and FuncUnit commands are sent to the test window via Selenium RC.</p>
306
+
307
+ <p>The envjs script (written for both Windows and OS X/Linux), is used to load your test page (the
308
+ same one that runs tests in the browser) in Env.js, a simulated browser running on Rhino. The
309
+ test page recognizes its running in the Rhino context and issues commands to Selenium accordingly.</p>
310
+
311
+ <p>Running these command line tests is simple:</p>
312
+ @codestart
313
+ my\path\to\envjs my\path\to\funcunit.html
314
+ @codeend
315
+ <p>Configuring settings for the command line mode will be covered next.</p>
316
+ <h3>Configuration</h3>
317
+ <p>FuncUnit loads a settings.js file every time it is runs in Selenium mode. This file defines
318
+ configuration that tells Selenium how to run. You can change which browsers run, their location,
319
+ the domain to serve from, and the speed of test execution.</p>
320
+ <p>FuncUnit looks first in the same directory as the funcunit page you're running tests from for
321
+ settings.js. For example if you're running FuncUnit like this:</p>
322
+ @codestart
323
+ funcunit\envjs phui\combobox\funcunit.html
324
+ @codeend
325
+ <p>It will look first for phui/combobox/settings.js.</p>
326
+ <p>Then it looks in its own root directory, where a default settings.js exists.
327
+ This is to allow you to create different settings for different projects.</p>
328
+ <h3>Setting Browsers</h3>
329
+ <p>FuncUnit.browsers is an array that defines which browsers Selenium opens and runs your tests in.
330
+ This is defined in settings.js. If this null it will default to a standard set of browsers for your OS
331
+ (FF and IE on Windows, FF on everything else). You populate it with strings like the following:</p>
332
+ @codestart
333
+ browsers: ["*firefox", "*iexplore", "*safari", "*googlechrome"]
334
+ @codeend
335
+ <p>To define a custom path to a browser, put this in the string following the browser name like this:</p>
336
+ @codestart
337
+ browsers: ["*custom /path/to/my/browser"]
338
+ @codeend
339
+ <p>See the
340
+ [http://release.seleniumhq.org/selenium-remote-control/0.9.0/doc/java/com/thoughtworks/selenium/DefaultSelenium.html#DefaultSelenium Selenium docs]
341
+ for more information on customizing browsers and other settings.</p>
342
+ <h3>Filesystem for Faster Tests</h3>
343
+ <p>You might want to use envjs to open local funcunit pages, but test pages on your server. This is possible, you
344
+ just have to change FuncUnit.href or FuncUnit.jmvcRoot. This file can load locally while everything else is
345
+ using a server because it is a static file and loads static script files.</p>
346
+
347
+ <p>Set jmvcRoot to point to the location you want your pages to load from, like this:</p>
348
+ @codestart
349
+ jmvcRoot: "localhost:8000"
350
+ @codeend
351
+
352
+ <p>Then make sure your test paths contain // in them to signify something relative to the jmvcRoot.
353
+ For example, S.open("//funcunit/test/myapp.html") would open a page at
354
+ http://localhost:8000/funcunit/test/myapp.html.</p>
355
+
356
+ <p>To load the command page from filesystem, start your test like you normally do:</p>
357
+ @codestart
358
+ funcunit\envjs path\to\funcunit.html
359
+ @codeend
360
+
361
+ <h3>Running Served Pages</h3>
362
+ <p>Certain browsers, like Safari and Chrome, don't run Selenium tests from filesystem because
363
+ of security resrictions. To get around this you have to run pages served from a server. The
364
+ downside of this is the test takes longer to start up, compared to loading from filesystem.</p>
365
+ <p>To do this, provide an absolute path in your envjs path, like this:</p>
366
+ @codestart
367
+ funcunit\envjs http://localhost:8000/path/to/funcunit.html
368
+ @codeend
369
+ <p>and set jmvcRoot and your paths as directed in the previous section. This will cause the command page
370
+ and the test pages to load from your server.</p>
371
+
372
+ <h3>Slow Mode</h3>
373
+ <p>You can slow down the amount of time between tests by setting FuncUnit.speed. By default, FuncUnit commands
374
+ in Selenium will run as soon as the previous command is complete. If you set FuncUnit.speed to "slow" this
375
+ becomes 500ms between commands. You may also provide a number of milliseconds.
376
+ Slow mode is useful while debugging.</p>
377
+
378
+ <h2>Limitations</h2>
379
+ <ul>
380
+ <li>Selenium doesn't run Chrome/Opera/Safari on the filesystem.</li>
381
+ </ul>
382
+ *
383
+ * @init
384
+ * selects something in the other page
385
+ * @param {String|Function|Object} selector FuncUnit behaves differently depending if
386
+ * the selector is a string, a function, or an object.
387
+ * <h5>String</h5>
388
+ * The selector is treated as a css selector.
389
+ * jQuery/Sizzle is used as the selector so any selector it understands
390
+ * will work with funcUnit. FuncUnit does not perform the selection until a
391
+ * command is called upon this selector. This makes aliasing the selectors to
392
+ * JavaScript variables a great technique.
393
+ * <h5>Function</h5>
394
+ * If a function is provided, it will add that function to the action queue to be run
395
+ * after previous actions and waits.
396
+ * <h5>Object</h5>
397
+ * If you want to reference the window or document, pass <code>S.window</code>
398
+ * or <code>S.window.document</code> to the selector.
399
+ *
400
+ * @param {Number} [context] If provided, the context is the frame number in the
401
+ * document.frames array to use as the context of the selector.
402
+ */
403
+ FuncUnit = function(selector, context){
404
+ if(typeof selector == "function"){
405
+ return FuncUnit.wait(0, selector)
406
+ }
407
+
408
+ return new FuncUnit.init(selector, context)
409
+ }
410
+ /**
411
+ * @Static
412
+ */
413
+ window.jQuery.extend(FuncUnit,oldFunc)
414
+ window.jQuery.extend(FuncUnit,{
415
+ //move jquery and clear it out
416
+ jquery : jQuery.noConflict(true),
417
+ /**
418
+ * @attribute href
419
+ * The location of the page running the tests on the server and where relative paths passed in to [FuncUnit.static.open] will be
420
+ * referenced from.
421
+ * <p>This is typically where the test page runs on the server. It can be set before calls to [FuncUnit.static.open]:</p>
422
+ @codestart
423
+ test("opening something", function(){
424
+ S.href = "http://localhost/tests/mytest.html"
425
+ S.open("../myapp")
426
+ ...
427
+ })
428
+ @codeend
429
+ */
430
+ // href comes from settings
431
+ /**
432
+ * @attribute jmvcRoot
433
+ * jmvcRoot should be set to url of JMVC's root folder.
434
+ * <p>This is used to calculate JMVC style paths (paths that begin with //).
435
+ * This is the prefered method of referencing pages if
436
+ * you want to test on the filesystem and test on the server.</p>
437
+ * <p>This is usually set in the global config file in <code>funcunit/settings.js</code> like:</p>
438
+ @codestart
439
+ FuncUnit = {jmvcRoot: "http://localhost/script/" }
440
+ @codeend
441
+ */
442
+ // jmvcRoot comes from settings
443
+
444
+ /**
445
+ * Opens a page. It will error if the page can't be opened before timeout.
446
+ * <h3>Example</h3>
447
+ @codestart
448
+ //a full url
449
+ S.open("http://localhost/app/app.html")
450
+
451
+ //from jmvc root (FuncUnit.jmvcRoot must be set)
452
+ S.open("//app/app.html")
453
+ @codeend
454
+
455
+ * <h3>Paths in Selenium</h3>
456
+ * Selenium runs the testing page from the filesystem and by default will look for pages on the filesystem unless provided a full
457
+ * url or information that can translate a partial path into a full url. FuncUnit uses [FuncUnit.static.jmvcRoot]
458
+ * and [FuncUnit.static.href] to
459
+ * translate partial paths.
460
+ <table>
461
+ <tr>
462
+ <th>path</th>
463
+ <th>jmvcRoot</th>
464
+ <th>href</th>
465
+ <th>resulting url</th>
466
+ </tr>
467
+ <tr>
468
+ <td>//myapp/mypage.html</td>
469
+ <td>null</td>
470
+ <td>null</td>
471
+ <td>file:///C:/development/cookbook/public/myapp/mypage.html</td>
472
+ </tr>
473
+ <tr>
474
+ <td>//myapp/mypage.html</td>
475
+ <td>http://localhost/</td>
476
+ <td></td>
477
+ <td>http://localhost/myapp/mypage.html</td>
478
+ </tr>
479
+ <tr>
480
+ <td>http://foo.com</td>
481
+ <td></td>
482
+ <td></td>
483
+ <td>http://foo.com</td>
484
+ </tr>
485
+ <tr>
486
+ <td>../mypage.html</td>
487
+ <td></td>
488
+ <td>http://localhost/myapp/funcunit.html</td>
489
+ <td>http://localhost/mypage.html</td>
490
+ </tr>
491
+ </table>
492
+ *
493
+ * @param {String} path a full or partial url to open. If a partial is given,
494
+ * @param {Function} callback
495
+ * @param {Number} timeout
496
+ */
497
+ open: function( path, callback, timeout ) {
498
+ var fullPath = FuncUnit.getAbsolutePath(path),
499
+ temp;
500
+ if(typeof callback != 'function'){
501
+ timeout = callback;
502
+ callback = undefined;
503
+ }
504
+ FuncUnit.add(function(success, error){ //function that actually does stuff, if this doesn't call success by timeout, error will be called, or can call error itself
505
+ steal.dev.log("Opening "+path)
506
+ FuncUnit._open(fullPath, error);
507
+ FuncUnit._onload(function(){
508
+ FuncUnit._opened();
509
+ success()
510
+ }, error);
511
+ }, callback, "Page " + path + " not loaded in time!", timeout || 30000);
512
+ },
513
+ /**
514
+ * @hide
515
+ * Gets a path, will use steal if present
516
+ * @param {String} path
517
+ */
518
+ getAbsolutePath: function( path ) {
519
+ if(typeof(steal) == "undefined"){
520
+ return path;
521
+ }
522
+ var fullPath,
523
+ root = FuncUnit.jmvcRoot || steal.root.path;
524
+
525
+ if (/^\/\//.test(path)) {
526
+ fullPath = new steal.File(path.substr(2)).joinFrom(root);
527
+ }
528
+ else {
529
+ fullPath = path;
530
+ }
531
+
532
+ if(/^http/.test(path))
533
+ fullPath = path;
534
+ return fullPath;
535
+ },
536
+ /**
537
+ * @attribute browsers
538
+ * Used to configure the browsers selenium uses to run FuncUnit tests.
539
+ * If you need to learn how to configure selenium, and we haven't filled in this page,
540
+ * post a note on the forum and we will fill this out right away.
541
+ */
542
+ // for feature detection
543
+ support : {},
544
+ /**
545
+ * @attribute window
546
+ * Use this to refer to the window of the application page. You can also
547
+ * reference window.document.
548
+ * @codestart
549
+ * S(S.window).innerWidth(function(w){
550
+ * ok(w > 1000, "window is more than 1000 px wide")
551
+ * })
552
+ * @codeend
553
+ */
554
+ window : {
555
+ document: {}
556
+ },
557
+ _opened: function() {}
558
+ });
559
+
560
+
561
+ (function(){
562
+ //the queue of commands waiting to be run
563
+ var queue = [],
564
+ //are we in a callback function (something we pass to a FuncUnit plugin)
565
+ incallback = false,
566
+ //where we should add things in a callback
567
+ currentPosition = 0;
568
+
569
+
570
+ FuncUnit.
571
+ /**
572
+ * @hide
573
+ * Adds a function to be called in the queue.
574
+ * @param {Function} f The function to be called. It will be provided a success and error function.
575
+ * @param {Function} callback a callback to be called after the function is done
576
+ * @param {Object} error an error statement if the command fails
577
+ * @param {Object} timeout the length of time until success should be called.
578
+ */
579
+ add = function(f, callback, error, timeout, stopper){
580
+
581
+ //if we are in a callback, add to the current position
582
+ if (incallback) {
583
+ queue.splice(currentPosition,0,{
584
+ method: f,
585
+ callback: callback,
586
+ error: error,
587
+ timeout: timeout,
588
+ stop : stopper
589
+ })
590
+ currentPosition++;
591
+ }
592
+ else {
593
+ //add to the end
594
+ queue.push({
595
+ method: f,
596
+ callback: callback,
597
+ error: error,
598
+ timeout: timeout
599
+ });
600
+ }
601
+ //if our queue has just started, stop qunit
602
+ //call done to call the next command
603
+ if (queue.length == 1 && ! incallback) {
604
+ stop();
605
+ setTimeout(FuncUnit._done, 13)
606
+ }
607
+ }
608
+ //this is called after every command
609
+ // it gets the next function from the queue
610
+ FuncUnit._done = function(){
611
+ var next,
612
+ timer,
613
+ speed = 0;
614
+
615
+ if(FuncUnit.speed == "slow"){
616
+ speed = 500;
617
+ }
618
+ else if (FuncUnit.speed){
619
+ speed = FuncUnit.speed;
620
+ }
621
+ if (queue.length > 0) {
622
+ next = queue.shift();
623
+ currentPosition = 0;
624
+ // set a timer that will error
625
+
626
+
627
+ //call next method
628
+ setTimeout(function(){
629
+ timer = setTimeout(function(){
630
+ next.stop && next.stop();
631
+ ok(false, next.error);
632
+ FuncUnit._done();
633
+ },
634
+ (next.timeout || 10000) + speed)
635
+
636
+ next.method( //success
637
+ function(){
638
+ //make sure we don't create an error
639
+ clearTimeout(timer);
640
+
641
+ //mark in callback so the next set of add get added to the front
642
+
643
+ incallback = true;
644
+ if (next.callback)
645
+ next.callback.apply(null, arguments);
646
+ incallback = false;
647
+
648
+
649
+ FuncUnit._done();
650
+ }, //error
651
+ function(message){
652
+ clearTimeout(timer);
653
+ ok(false, message);
654
+ FuncUnit._done();
655
+ })
656
+
657
+
658
+ }, speed);
659
+
660
+ }
661
+ else {
662
+ start();
663
+ }
664
+ }
665
+ FuncUnit.
666
+ /**
667
+ * Waits a timeout before running the next command. Wait is an action and gets
668
+ * added to the queue.
669
+ * @codestart
670
+ * S.wait(100, function(){
671
+ * equals( S('#foo').innerWidth(), 100, "innerWidth is 100");
672
+ * })
673
+ * @codeend
674
+ * @param {Number} [time] The timeout in milliseconds. Defaults to 5000.
675
+ * @param {Function} [callback] A callback that will run
676
+ * after the wait has completed,
677
+ * but before any more queued actions.
678
+ */
679
+ wait = function(time, callback){
680
+ if(typeof time == 'function'){
681
+ callback = time;
682
+ time = undefined;
683
+ }
684
+ time = time != null ? time : 5000
685
+ FuncUnit.add(function(success, error){
686
+ steal.dev.log("Waiting "+time)
687
+ setTimeout(success, time)
688
+ }, callback, "Couldn't wait!", time + 1000);
689
+ return this;
690
+ }
691
+ /**
692
+ * @hide
693
+ * @function repeat
694
+ * Takes a function that will be called over and over until it is successful.
695
+ */
696
+ FuncUnit.repeat = function(checker, callback, error, timeout){
697
+ var interval,
698
+ stopped = false ,
699
+ stop = function(){
700
+ clearTimeout(interval)
701
+ stopped = true;
702
+ };
703
+
704
+ FuncUnit.add(function(success, error){
705
+ interval = setTimeout(function(){
706
+
707
+ var result = null;
708
+ try {
709
+ result = checker()
710
+ }
711
+ catch (e) {
712
+ //should we throw this too error?
713
+ }
714
+
715
+ if (result) {
716
+ success();
717
+ }else if(!stopped){
718
+ interval = setTimeout(arguments.callee, 10)
719
+ }
720
+
721
+ }, 10);
722
+
723
+
724
+ }, callback, error, timeout, stop)
725
+ }
726
+
727
+
728
+
729
+ FuncUnit.makeArray = function(arr){
730
+ var narr = [];
731
+ for (var i = 0; i < arr.length; i++) {
732
+ narr[i] = arr[i]
733
+ }
734
+ return narr;
735
+ }
736
+ FuncUnit.
737
+ /**
738
+ * @hide
739
+ * Converts a string into a Native JS type.
740
+ * @param {Object} str
741
+ */
742
+ convert = function(str){
743
+ //if it is an object and not null, eval it
744
+ if (str !== null && typeof str == "object") {
745
+ return object;
746
+ }
747
+ str = String(str);
748
+ switch (str) {
749
+ case "false":
750
+ return false;
751
+ case "null":
752
+ return null;
753
+ case "true":
754
+ return true;
755
+ case "undefined":
756
+ return undefined;
757
+ default:
758
+ if (/^\d+\.\d+$/.test(str) || /^\d+$/.test(str)) {
759
+ return 1 * str;
760
+ }
761
+
762
+ return str;
763
+ }
764
+ }
765
+
766
+ })();
767
+
768
+
769
+ /**
770
+ * @prototype
771
+ */
772
+ FuncUnit.init = function(s, c){
773
+ this.selector = s;
774
+ this.context = c == null ? FuncUnit.window.document : c;
775
+ }
776
+ FuncUnit.init.prototype = {
777
+ /**
778
+ * Types text into an element. This makes use of [Syn.prototype.type] and works in
779
+ * a very similar way.
780
+ * <h3>Quick Examples</h3>
781
+ * @codestart
782
+ * //types hello world
783
+ * S('#bar').type('hello world')
784
+ *
785
+ * //submits a form by typing \r
786
+ * S("input[name=age]").type("27\r")
787
+ *
788
+ * //types FuncUnit, then deletes the Unit
789
+ * S('#foo').type("FuncUnit\b\b\b\b")
790
+ *
791
+ * //types JavaScriptMVC, then removes the MVC
792
+ * S('#zar').type("JavaScriptMVC[left][left][left]"+
793
+ * "[delete][delete][delete]")
794
+ *
795
+ * //types JavaScriptMVC, then selects the MVC and
796
+ * //deletes it
797
+ * S('#zar').type("JavaScriptMVC[shift]"+
798
+ * "[left][left][left]"+
799
+ * "[shift-up][delete]")
800
+ * @codeend
801
+ * <h2>Characters</h2>
802
+ * You can type the characters found in [Syn.static.keycodes].
803
+ *
804
+ * @param {String} text the text you want to type
805
+ * @param {Function} [callback] a callback that is run after typing, but before the next action.
806
+ * @return {FuncUnit} returns the funcUnit for chaining.
807
+ */
808
+ type: function( text, callback ) {
809
+ var selector = this.selector,
810
+ context = this.context;
811
+ FuncUnit.add(function(success, error){
812
+ steal.dev.log("Typing "+text+" on "+selector)
813
+ FuncUnit.$(selector, context, "triggerSyn", "_type", text, success)
814
+ }, callback, "Could not type " + text + " into " + this.selector);
815
+ return this;
816
+ },
817
+ /**
818
+ * Waits until an element exists before running the next action.
819
+ * @codestart
820
+ * //waits until #foo exists before clicking it.
821
+ * S("#foo").exists().click()
822
+ * @codeend
823
+ * @param {Function} [callback] a callback that is run after the selector exists, but before the next action.
824
+ * @return {FuncUnit} returns the funcUnit for chaining.
825
+ */
826
+ exists: function( callback ) {
827
+ if(true){
828
+ return this.size(function(size){
829
+ return size > 0;
830
+ }, callback)
831
+ }
832
+ return this.size() == 0;
833
+ },
834
+ /**
835
+ * Waits until no elements are matched by the selector. Missing is equivalent to calling
836
+ * <code>.size(0, callback);</code>
837
+ * @codestart
838
+ * //waits until #foo leaves before continuing to the next action.
839
+ * S("#foo").missing()
840
+ * @codeend
841
+ * @param {Function} [callback] a callback that is run after the selector exists, but before the next action
842
+ * @return {FuncUnit} returns the funcUnit for chaining.
843
+ */
844
+ missing: function( callback ) {
845
+ return this.size(0, callback)
846
+ },
847
+ /**
848
+ * Waits until the funcUnit selector is visible.
849
+ * @codestart
850
+ * //waits until #foo is visible.
851
+ * S("#foo").visible()
852
+ * @codeend
853
+ * @param {Function} [callback] a callback that runs after the funcUnit is visible, but before the next action.
854
+ * @return [funcUnit] returns the funcUnit for chaining.
855
+ */
856
+ visible: function( callback ) {
857
+ var self = this,
858
+ sel = this.selector,
859
+ ret;
860
+ this.selector += ":visible"
861
+ if(true){
862
+ return this.size(function(size){
863
+ return size > 0;
864
+ }, function(){
865
+ self.selector = sel;
866
+ callback && callback();
867
+ })
868
+ }else{
869
+ ret = this.size() > 0;
870
+ this.selector = sel;
871
+ return ret;
872
+ }
873
+
874
+ },
875
+ /**
876
+ * Waits until the selector is invisible.
877
+ * @codestart
878
+ * //waits until #foo is invisible.
879
+ * S("#foo").invisible()
880
+ * @codeend
881
+ * @param {Function} [callback] a callback that runs after the selector is invisible, but before the next action.
882
+ * @return [funcUnit] returns the funcUnit selector for chaining.
883
+ */
884
+ invisible: function( callback ) {
885
+ var self = this,
886
+ sel = this.selector,
887
+ ret;
888
+ if(true){
889
+ this.selector += ":visible"
890
+ return this.size(0, function(){
891
+ self.selector = sel;
892
+ callback && callback();
893
+ })
894
+ }else{
895
+ ret = this.size() == 0;
896
+ this.selector = sel;
897
+ return ret;
898
+ }
899
+
900
+ },
901
+ /**
902
+ * Drags an element into another element or coordinates.
903
+ * This takes the same paramameters as [Syn.prototype.move move].
904
+ * @param {String|Object} options A selector or coordinates describing the motion of the drag.
905
+ * <h5>Options as a Selector</h5>
906
+ * Passing a string selector to drag the mouse. The drag runs to the center of the element
907
+ * matched by the selector. The following drags from the center of #foo to the center of #bar.
908
+ * @codestart
909
+ * S('#foo').drag('#bar')
910
+ * @codeend
911
+ * <h5>Options as Coordinates</h5>
912
+ * You can pass in coordinates as clientX and clientY:
913
+ * @codestart
914
+ * S('#foo').drag('100x200')
915
+ * @codeend
916
+ * Or as pageX and pageY
917
+ * @codestart
918
+ * S('#foo').drag('100X200')
919
+ * @codeend
920
+ * Or relative to the start position
921
+ * S('#foo').drag('+10 +20')
922
+ * <h5>Options as an Object</h5>
923
+ * You can configure the duration, start, and end point of a drag by passing in a json object.
924
+ * @codestart
925
+ * //drags from 0x0 to 100x100 in 2 seconds
926
+ * S('#foo').drag({
927
+ * from: "0x0",
928
+ * to: "100x100",
929
+ * duration: 2000
930
+ * })
931
+ * @codeend
932
+ * @param {Function} [callback] a callback that runs after the drag, but before the next action.
933
+ * @return {funcUnit} returns the funcunit selector for chaining.
934
+ */
935
+ drag: function( options, callback ) {
936
+ if(typeof options == 'string'){
937
+ options = {to: options}
938
+ }
939
+ options.from = this.selector;
940
+
941
+ var selector = this.selector,
942
+ context = this.context;
943
+ FuncUnit.add(function(success, error){
944
+ steal.dev.log("dragging "+selector)
945
+ FuncUnit.$(selector, context, "triggerSyn", "_drag", options, success)
946
+ }, callback, "Could not drag " + this.selector)
947
+ return this;
948
+ },
949
+ /**
950
+ * Moves an element into another element or coordinates. This will trigger mouseover
951
+ * mouseouts accordingly.
952
+ * This takes the same paramameters as [Syn.prototype.move move].
953
+ * @param {String|Object} options A selector or coordinates describing the motion of the move.
954
+ * <h5>Options as a Selector</h5>
955
+ * Passing a string selector to move the mouse. The move runs to the center of the element
956
+ * matched by the selector. The following moves from the center of #foo to the center of #bar.
957
+ * @codestart
958
+ * S('#foo').move('#bar')
959
+ * @codeend
960
+ * <h5>Options as Coordinates</h5>
961
+ * You can pass in coordinates as clientX and clientY:
962
+ * @codestart
963
+ * S('#foo').move('100x200')
964
+ * @codeend
965
+ * Or as pageX and pageY
966
+ * @codestart
967
+ * S('#foo').move('100X200')
968
+ * @codeend
969
+ * Or relative to the start position
970
+ * S('#foo').move('+10 +20')
971
+ * <h5>Options as an Object</h5>
972
+ * You can configure the duration, start, and end point of a move by passing in a json object.
973
+ * @codestart
974
+ * //drags from 0x0 to 100x100 in 2 seconds
975
+ * S('#foo').move({
976
+ * from: "0x0",
977
+ * to: "100x100",
978
+ * duration: 2000
979
+ * })
980
+ * @codeend
981
+ * @param {Function} [callback] a callback that runs after the drag, but before the next action.
982
+ * @return {funcUnit} returns the funcunit selector for chaining.
983
+ */
984
+ move: function( options, callback ) {
985
+ if(typeof options == 'string'){
986
+ options = {to: options}
987
+ }
988
+ options.from = this.selector;
989
+
990
+ var selector = this.selector,
991
+ context = this.context;
992
+ FuncUnit.add(function(success, error){
993
+ steal.dev.log("moving "+selector)
994
+ FuncUnit.$(selector, context, "triggerSyn", "_move", options, success)
995
+ }, callback, "Could not move " + this.selector)
996
+ return this;
997
+ },
998
+ /**
999
+ * Scrolls an element in a particular direction by setting the scrollTop or srollLeft.
1000
+ * @param {String} direction "left" or "top"
1001
+ * @param {Number} amount number of pixels to scroll
1002
+ * @param {Function} callback
1003
+ */
1004
+ scroll: function( direction, amount, callback ) {
1005
+ var selector = this.selector,
1006
+ context = this.context,
1007
+ direction = /left|right|x/i.test(direction)? "Left" : "Right";
1008
+ FuncUnit.add(function(success, error){
1009
+ steal.dev.log("setting "+selector+ " scroll"+direction+" "+amount+" pixels")
1010
+ FuncUnit.$(selector, context, "scroll"+direction, amount)
1011
+ success();
1012
+ }, callback, "Could not scroll " + this.selector)
1013
+ return this;
1014
+ },
1015
+ /**
1016
+ * Waits a timeout before calling the next action. This is the same as
1017
+ * [FuncUnit.prototype.wait].
1018
+ * @param {Number} [timeout]
1019
+ * @param {Object} callback
1020
+ */
1021
+ wait: function( timeout, callback ) {
1022
+ FuncUnit.wait(timeout, callback)
1023
+ }
1024
+ };
1025
+ var clicks = [
1026
+ /**
1027
+ * @function click
1028
+ * Clicks an element. This uses [Syn.prototype.click] to issue a:
1029
+ * <ul>
1030
+ * <li><code>mousedown</code></li>
1031
+ * <li><code>focus</code> - if the element is focusable</li>
1032
+ * <li><code>mouseup</code></li>
1033
+ * <li><code>click</code></li>
1034
+ * </ul>
1035
+ * If no clientX/Y or pageX/Y is provided as options, the click happens at the
1036
+ * center of the element.
1037
+ * <p>For a right click or double click use [FuncUnit.prototype.rightClick] or
1038
+ * [FuncUnit.prototype.dblclick].</p>
1039
+ * <h3>Example</h3>
1040
+ * @codestart
1041
+ * //clicks the bar element
1042
+ * S("#bar").click()
1043
+ * @codeend
1044
+ * @param {Object} [options] options to pass to the click event. Typically, this is clientX/Y or pageX/Y like:
1045
+ * @codestart
1046
+ * $('#foo').click({pageX: 200, pageY: 100});
1047
+ * @codeend
1048
+ * You can pass it any of the serializable parameters you'd send to :
1049
+ * [http://developer.mozilla.org/en/DOM/event.initMouseEvent initMouseEvent], but command keys are
1050
+ * controlled by [FuncUnit.prototype.type].
1051
+ * @param {Function} [callback] a callback that runs after the click, but before the next action.
1052
+ * @return {funcUnit} returns the funcunit selector for chaining.
1053
+ */
1054
+ 'click',
1055
+ /**
1056
+ * @function dblclick
1057
+ * Double clicks an element by [FuncUnit.prototype.click clicking] it twice and triggering a dblclick event.
1058
+ * @param {Object} options options to add to the mouse events. This works
1059
+ * the same as [FuncUnit.prototype.click]'s options.
1060
+ * @param {Function} [callback] a callback that runs after the double click, but before the next action.
1061
+ * @return {funcUnit} returns the funcunit selector for chaining.
1062
+ */
1063
+ 'dblclick',
1064
+ /**
1065
+ * @function rightClick
1066
+ * Right clicks an element. This typically results in a contextmenu event for browsers that
1067
+ * support it.
1068
+ * @param {Object} options options to add to the mouse events. This works
1069
+ * the same as [FuncUnit.prototype.click]'s options.
1070
+ * @param {Function} [callback] a callback that runs after the click, but before the next action.
1071
+ * @return {funcUnit} returns the funcunit selector for chaining.
1072
+ */
1073
+ 'rightClick'],
1074
+ makeClick = function(name){
1075
+ FuncUnit.init.prototype[name] = function(options, callback){
1076
+ if(typeof options == 'function'){
1077
+ callback = options;
1078
+ options = {};
1079
+ }
1080
+ var selector = this.selector,
1081
+ context = this.context;
1082
+ FuncUnit.add(function(success, error){
1083
+ options = options || {}
1084
+ steal.dev.log("Clicking "+selector)
1085
+ FuncUnit.$(selector, context, "triggerSyn", "_"+name, options, success)
1086
+ }, callback, "Could not "+name+" " + this.selector)
1087
+ return this;
1088
+ }
1089
+ }
1090
+
1091
+ for(var i=0; i < clicks.length; i++){
1092
+ makeClick(clicks[i])
1093
+ }
1094
+
1095
+
1096
+ //list of jQuery functions we want, number is argument index
1097
+ //for wait instead of getting value
1098
+ FuncUnit.funcs = {
1099
+ /**
1100
+ * @function size
1101
+ * Gets the number of elements matched by the selector or
1102
+ * waits until the the selector is size. You can also
1103
+ * provide a function that continues to the next action when
1104
+ * it returns true.
1105
+ * @codestart
1106
+ * S(".recipe").size() //gets the number of recipes
1107
+ *
1108
+ * S(".recipe").size(2) //waits until there are 2 recipes
1109
+ *
1110
+ * //waits until size is count
1111
+ * S(".recipe").size(function(size){
1112
+ * return size == count;
1113
+ * })
1114
+ * @codeend
1115
+ * @param {Number|Function} [size] number or a checking function.
1116
+ * @param {Function} a callback that will run after this action completes.
1117
+ * @return {Number} if the size parameter is not provided, size returns the number
1118
+ * of elements matched.
1119
+ */
1120
+ 'size' : 0,
1121
+ /**
1122
+ * @attr data
1123
+ * Gets data from jQuery.data or waits until data
1124
+ * equals some value.
1125
+ * @codestart
1126
+ * S("#something").data("abc") //gets the abc data
1127
+ *
1128
+ * S("#something").data("abc","some") //waits until the data == some
1129
+ * @codeend
1130
+ * @param {String} data The data to get, or wait for.
1131
+ * @param {Object|Function} [value] If provided uses this as a check before continuing to the next action.
1132
+ * @param {Function} a callback that will run after this action completes.
1133
+ * @return {Object} if the size parameter is not provided, returns
1134
+ * the object.
1135
+ */
1136
+ 'data': 1,
1137
+ /**
1138
+ * @function attr
1139
+ * Gets the value of an attribute from an element or waits until the attribute
1140
+ * equals the attr param.
1141
+ * @codestart
1142
+ * //gets the abc attribute
1143
+ * S("#something").attr("abc")
1144
+ *
1145
+ * //waits until the abc attribute == some
1146
+ * S("#something").attr("abc","some")
1147
+ * @codeend
1148
+ * @param {String} data The attribute to get, or wait for.
1149
+ * @param {String|Function} [value] If provided uses this as a check before continuing to the next action.
1150
+ * @param {Function} a callback that will run after this action completes.
1151
+ * @return {Object} if the attr parameter is not provided, returns
1152
+ * the attribute.
1153
+ */
1154
+ 'attr' : 1,
1155
+ /**
1156
+ * @function hasClass
1157
+ * @codestart
1158
+ * //returns if the element has the class in its className
1159
+ * S("#something").hasClass("selected");
1160
+ *
1161
+ * //waits until #something has selected in its className
1162
+ * S("#something").hasClass("selected",true);
1163
+ *
1164
+ * //waits until #something does not have selected in its className
1165
+ * S("#something").hasClass("selected",false);
1166
+ * @codeend
1167
+ * @param {String} className The part of the className to search for.
1168
+ * @param {Boolean|Function} [value] If provided uses this as a check before continuing to the next action.
1169
+ * @param {Function} [callback] a callback that will run after this action completes.
1170
+ * @return {Boolean|funcUnit} if the value parameter is not provided, returns
1171
+ * if the className is found in the element's className. If a value paramters is provided, returns funcUnit for chaining.
1172
+ */
1173
+ 'hasClass' : 1, //makes wait
1174
+ /**
1175
+ * @function html
1176
+ * Gets the [http://api.jquery.com/html/ html] from an element or waits until the html is a certain value.
1177
+ * @codestart
1178
+ * //checks foo's html has "JupiterJS"
1179
+ * ok( /JupiterJS/.test( S('#foo').html() ) )
1180
+ *
1181
+ * //waits until bar's html has JupiterJS
1182
+ * S('#foo').html(/JupiterJS/)
1183
+ *
1184
+ * //waits until bar's html is JupiterJS
1185
+ * S('#foo').html("JupiterJS")
1186
+ * @codeend
1187
+ *
1188
+ * @param {String|Function} [html] If provided uses this as a check before continuing to the next action.
1189
+ * @param {Function} [callback] a callback that will run after this action completes.
1190
+ * @return {String|funcUnit} if the html parameter is provided,
1191
+ * returns the funcUnit selector for chaining, otherwise returns the html of the selector.
1192
+ */
1193
+ 'html' : 0,
1194
+ /**
1195
+ * @function text
1196
+ * Gets the [http://api.jquery.com/text/ text] from an element or waits until the text is a certain value.
1197
+ * @codestart
1198
+ * //checks foo's text has "JupiterJS"
1199
+ * ok( /JupiterJS/.test( S('#foo').text() ) )
1200
+ *
1201
+ * //waits until bar's text has JupiterJS
1202
+ * S('#foo').text(/JupiterJS/)
1203
+ *
1204
+ * //waits until bar's text is JupiterJS
1205
+ * S('#foo').text("JupiterJS")
1206
+ * @codeend
1207
+ *
1208
+ * @param {String|Function} [text] If provided uses this as a check before continuing to the next action.
1209
+ * @param {Function} [callback] a callback that will run after this action completes.
1210
+ * @return {String|funcUnit} if the text parameter is provided,
1211
+ * returns the funcUnit selector for chaining, otherwise returns the html of the selector.
1212
+ */
1213
+ 'text' : 0,
1214
+ /**
1215
+ * @function val
1216
+ * Gets the [http://api.jquery.com/val/ val] from an element or waits until the val is a certain value.
1217
+ * @codestart
1218
+ * //checks foo's val has "JupiterJS"
1219
+ * ok( /JupiterJS/.test( S('input#foo').val() ) )
1220
+ *
1221
+ * //waits until bar's val has JupiterJS
1222
+ * S('input#foo').val(/JupiterJS/)
1223
+ *
1224
+ * //waits until bar's val is JupiterJS
1225
+ * S('input#foo').val("JupiterJS")
1226
+ * @codeend
1227
+ *
1228
+ * @param {String|Function} [val] If provided uses this as a check before continuing to the next action.
1229
+ * @param {Function} [callback] a callback that will run after this action completes.
1230
+ * @return {String|funcUnit} if the val parameter is provided,
1231
+ * returns the funcUnit selector for chaining, otherwise returns the html of the selector.
1232
+ */
1233
+ 'val' : 0,
1234
+ /**
1235
+ * @function css
1236
+ * Gets a [http://api.jquery.com/css/ css] property from an element or waits until the property is
1237
+ * a specified value.
1238
+ * @codestart
1239
+ * // gets the color
1240
+ * S("#foo").css("color")
1241
+ *
1242
+ * // waits until the color is red
1243
+ * S("#foo").css("color","red")
1244
+ * @codeend
1245
+ *
1246
+ * @param {String} prop A css property to get or wait until it is a specified value.
1247
+ * @param {String|Function} [val] If provided uses this as a check before continuing to the next action.
1248
+ * @param {Function} [callback] a callback that will run after this action completes.
1249
+ * @return {String|funcUnit} if the val parameter is provided,
1250
+ * returns the funcUnit selector for chaining, otherwise returns the css of the selector.
1251
+ */
1252
+ 'css': 1,
1253
+ /**
1254
+ * @function offset
1255
+ * Gets an element's [http://api.jquery.com/offset/ offset] or waits until
1256
+ * the offset is a specified value.
1257
+ * @codestart
1258
+ * // gets the offset
1259
+ * S("#foo").offset();
1260
+ *
1261
+ * // waits until the offset is 100, 200
1262
+ * S("#foo").offset({top: 100, left: 200})
1263
+ * @codeend
1264
+ *
1265
+ * @param {Object|Function} [offset] If provided uses this as a check before continuing to the next action. Or you can
1266
+ * provide a function that returns true to continue to the next action.
1267
+ * @param {Function} [callback] a callback that will run after this action completes.
1268
+ * @return {String|funcUnit} if the offset parameter is provided,
1269
+ * returns the funcUnit selector for chaining, otherwise returns the css of the selector.
1270
+ */
1271
+ 'offset' : 0,
1272
+ /**
1273
+ * @function position
1274
+ * Gets an element's [http://api.jquery.com/position/ position] or waits until
1275
+ * the position is a specified value.
1276
+ * @codestart
1277
+ * // gets the position
1278
+ * S("#foo").position();
1279
+ *
1280
+ * // waits until the position is 100, 200
1281
+ * S("#foo").position({top: 100, left: 200})
1282
+ * @codeend
1283
+ *
1284
+ * @param {Object|Function} [position] If provided uses this as a check before continuing to the next action. Or you can
1285
+ * provide a function that returns true to continue to the next action.
1286
+ * @param {Function} [callback] a callback that will run after this action completes.
1287
+ * @return {String|funcUnit} if the position parameter is provided,
1288
+ * returns the funcUnit selector for chaining, otherwise returns the offset of the selector.
1289
+ */
1290
+ 'position' : 0,
1291
+ /**
1292
+ * @function scrollTop
1293
+ * Gets an element's [http://api.jquery.com/scrollTop/ scrollTop] or waits until
1294
+ * it equals a specified value.
1295
+ * @codestart
1296
+ * // gets the scrollTop
1297
+ * S("#foo").scrollTop();
1298
+ *
1299
+ * // waits until the scrollTop is 100
1300
+ * S("#foo").scrollTop(100)
1301
+ * @codeend
1302
+ *
1303
+ * @param {Number|Function} [scrollTop] If provided uses this as a check before continuing to the next action. Or you can
1304
+ * provide a function that returns true to continue to the next action.
1305
+ * @param {Function} [callback] a callback that will run after this action completes.
1306
+ * @return {String|funcUnit} if scrollTop is provided,
1307
+ * returns the funcUnit selector for chaining, otherwise returns the scrollTop of the selector.
1308
+ */
1309
+ 'scrollTop' : 0,
1310
+ /**
1311
+ * @function scrollLeft
1312
+ * Gets an element's [http://api.jquery.com/scrollLeft/ scrollLeft] or waits until
1313
+ * it equals a specified value.
1314
+ * @codestart
1315
+ * // gets the scrollLeft
1316
+ * S("#foo").scrollLeft();
1317
+ *
1318
+ * // waits until the scrollLeft is 100
1319
+ * S("#foo").scrollLeft(100)
1320
+ * @codeend
1321
+ *
1322
+ * @param {Number|Function} [scrollLeft] If provided uses this as a check before continuing to the next action. Or you can
1323
+ * provide a function that returns true to continue to the next action.
1324
+ * @param {Function} [callback] a callback that will run after this action completes.
1325
+ * @return {String|funcUnit} if scrollLeft is provided,
1326
+ * returns the funcUnit selector for chaining, otherwise returns the scrollLeft of the selector.
1327
+ */
1328
+ 'scrollLeft' : 0,
1329
+ /**
1330
+ * @function height
1331
+ * Gets an element's [http://api.jquery.com/height/ height] or waits until
1332
+ * it equals a specified value.
1333
+ * @codestart
1334
+ * // gets the height
1335
+ * S("#foo").height();
1336
+ *
1337
+ * // waits until the height is 100
1338
+ * S("#foo").height(100)
1339
+ * @codeend
1340
+ *
1341
+ * @param {Number|Function} [height] If provided uses this as a check before continuing to the next action. Or you can
1342
+ * provide a function that returns true to continue to the next action.
1343
+ * @param {Function} [callback] a callback that will run after this action completes.
1344
+ * @return {String|funcUnit} if height is provided,
1345
+ * returns the funcUnit selector for chaining, otherwise returns the height of the selector.
1346
+ */
1347
+ 'height' : 0,
1348
+ /**
1349
+ * @function width
1350
+ * Gets an element's [http://api.jquery.com/width/ width] or waits until
1351
+ * it equals a specified value.
1352
+ * @codestart
1353
+ * // gets the width
1354
+ * S("#foo").width();
1355
+ *
1356
+ * // waits until the width is 100
1357
+ * S("#foo").width(100)
1358
+ * @codeend
1359
+ *
1360
+ * @param {Number|Function} [width] If provided uses this as a check before continuing to the next action. Or you can
1361
+ * provide a function that returns true to continue to the next action.
1362
+ * @param {Function} [callback] a callback that will run after this action completes.
1363
+ * @return {String|funcUnit} if width is provided,
1364
+ * returns the funcUnit selector for chaining, otherwise returns the width of the selector.
1365
+ */
1366
+ 'width' : 0,
1367
+ /**
1368
+ * @function innerHeight
1369
+ * Gets an element's [http://api.jquery.com/innerHeight/ innerHeight] or waits until
1370
+ * it equals a specified value.
1371
+ * @codestart
1372
+ * // gets the innerHeight
1373
+ * S("#foo").innerHeight();
1374
+ *
1375
+ * // waits until the innerHeight is 100
1376
+ * S("#foo").innerHeight(100)
1377
+ * @codeend
1378
+ *
1379
+ * @param {Number|Function} [innerHeight] If provided uses this as a check before continuing to the next action. Or you can
1380
+ * provide a function that returns true to continue to the next action.
1381
+ * @param {Function} [callback] a callback that will run after this action completes.
1382
+ * @return {String|funcUnit} if innerHeight is provided,
1383
+ * returns the funcUnit selector for chaining, otherwise returns the innerHeight of the selector.
1384
+ */
1385
+ 'innerHeight' : 0,
1386
+ /**
1387
+ * @function innerWidth
1388
+ * Gets an element's [http://api.jquery.com/innerWidth/ innerWidth] or waits until
1389
+ * it equals a specified value.
1390
+ * @codestart
1391
+ * // gets the innerWidth
1392
+ * S("#foo").innerWidth();
1393
+ *
1394
+ * // waits until the innerWidth is 100
1395
+ * S("#foo").innerWidth(100)
1396
+ * @codeend
1397
+ *
1398
+ * @param {Number|Function} [innerWidth] If provided uses this as a check before continuing to the next action. Or you can
1399
+ * provide a function that returns true to continue to the next action.
1400
+ * @param {Function} [callback] a callback that will run after this action completes.
1401
+ * @return {String|funcUnit} if innerWidth is provided,
1402
+ * returns the funcUnit selector for chaining, otherwise returns the innerWidth of the selector.
1403
+ */
1404
+ 'innerWidth' : 0,
1405
+ /**
1406
+ * @function outerHeight
1407
+ * Gets an element's [http://api.jquery.com/outerHeight/ outerHeight] or waits until
1408
+ * it equals a specified value.
1409
+ * @codestart
1410
+ * // gets the outerHeight
1411
+ * S("#foo").outerHeight();
1412
+ *
1413
+ * // waits until the outerHeight is 100
1414
+ * S("#foo").outerHeight(100)
1415
+ * @codeend
1416
+ *
1417
+ * @param {Number|Function} [outerHeight] If provided uses this as a check before continuing to the next action. Or you can
1418
+ * provide a function that returns true to continue to the next action.
1419
+ * @param {Function} [callback] a callback that will run after this action completes.
1420
+ * @return {String|funcUnit} if outerHeight is provided,
1421
+ * returns the funcUnit selector for chaining, otherwise returns the outerHeight of the selector.
1422
+ */
1423
+ 'outerHeight' : 0,
1424
+ /**
1425
+ * @function outerWidth
1426
+ * Gets an element's [http://api.jquery.com/outerWidth/ outerWidth] or waits until
1427
+ * it equals a specified value.
1428
+ * @codestart
1429
+ * // gets the outerWidth
1430
+ * S("#foo").outerWidth();
1431
+ *
1432
+ * // waits until the outerWidth is 100
1433
+ * S("#foo").outerWidth(100)
1434
+ * @codeend
1435
+ *
1436
+ * @param {Number|Function} [outerWidth] If provided uses this as a check before continuing to the next action. Or you can
1437
+ * provide a function that returns true to continue to the next action.
1438
+ * @param {Function} [callback] a callback that will run after this action completes.
1439
+ * @return {String|funcUnit} if outerWidth is provided,
1440
+ * returns the funcUnit selector for chaining, otherwise returns the outerWidth of the selector.
1441
+ */
1442
+ 'outerWidth' : 0}
1443
+
1444
+
1445
+ //makes a jQuery like command.
1446
+ FuncUnit.makeFunc = function(fname, argIndex){
1447
+
1448
+ //makes a read / wait function
1449
+ FuncUnit.init.prototype[fname] = function(){
1450
+ //assume last arg is callback
1451
+ var args = FuncUnit.makeArray(arguments),
1452
+ callback,
1453
+ isWait = args.length > argIndex,
1454
+ callback;
1455
+
1456
+ args.unshift(this.selector,this.context,fname)
1457
+
1458
+ if(isWait){
1459
+ //get the args greater and equal to argIndex
1460
+ var tester = args[argIndex+3],
1461
+ timeout = args[argIndex+4],
1462
+ callback = args[argIndex+5],
1463
+ testVal = tester,
1464
+ errorMessage = "waiting for "+fname +" on " + this.selector;
1465
+
1466
+ if(typeof timeout == 'function'){
1467
+ callback = timeout;
1468
+ timeout = undefined;
1469
+ }
1470
+
1471
+ args.splice(argIndex+3, args.length- argIndex - 3);
1472
+
1473
+ if(typeof tester != 'function'){
1474
+ errorMessage += " !== "+testVal
1475
+ tester = function(val){
1476
+
1477
+ return QUnit.equiv(val, testVal) ||
1478
+ (testVal instanceof RegExp && testVal.test(val) );
1479
+ }
1480
+ }
1481
+ FuncUnit.repeat(function(){
1482
+ var ret = FuncUnit.$.apply(FuncUnit.$, args);
1483
+ return tester(ret);
1484
+ }, callback, errorMessage, timeout)
1485
+
1486
+ return this;
1487
+ }else{
1488
+ //get the value
1489
+ steal.dev.log("Getting "+fname+" on "+this.selector)
1490
+ return FuncUnit.$.apply(FuncUnit.$, args);
1491
+ }
1492
+ }
1493
+ }
1494
+
1495
+
1496
+
1497
+ for (var prop in FuncUnit.funcs) {
1498
+ FuncUnit.makeFunc(prop, FuncUnit.funcs[prop]);
1499
+ }
1500
+
1501
+
1502
+ S = FuncUnit;
1503
+
1504
+
1505
+ })
1506
+ //now add drivers
1507
+ .then('resources/selenium_start',
1508
+ 'drivers/selenium',
1509
+ 'drivers/standard')