adva_cms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (551) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +22 -0
  5. data/NOTES +132 -0
  6. data/README.md +29 -0
  7. data/Rakefile +2 -0
  8. data/adva_cms.gemspec +22 -0
  9. data/app/assets/images/adva_cms/admin/header_bg.png +0 -0
  10. data/app/assets/images/adva_cms/admin/section_menu_bg.png +0 -0
  11. data/app/assets/images/adva_cms/admin/tab_action_active.png +0 -0
  12. data/app/assets/images/adva_cms/admin/tab_main_active.png +0 -0
  13. data/app/assets/images/adva_cms/admin/tab_sidebar_active.png +0 -0
  14. data/app/assets/images/adva_cms/admin/tab_top_active.png +0 -0
  15. data/app/assets/images/adva_cms/asset_selected.png +0 -0
  16. data/app/assets/images/adva_cms/avatar.gif +0 -0
  17. data/app/assets/images/adva_cms/filter-bg.png +0 -0
  18. data/app/assets/images/adva_cms/icons/accept.png +0 -0
  19. data/app/assets/images/adva_cms/icons/add.png +0 -0
  20. data/app/assets/images/adva_cms/icons/arrow_cross.png +0 -0
  21. data/app/assets/images/adva_cms/icons/arrow_cross_2.png +0 -0
  22. data/app/assets/images/adva_cms/icons/arrow_cross_3.png +0 -0
  23. data/app/assets/images/adva_cms/icons/arrow_up_down.png +0 -0
  24. data/app/assets/images/adva_cms/icons/assets/audio.png +0 -0
  25. data/app/assets/images/adva_cms/icons/assets/doc.png +0 -0
  26. data/app/assets/images/adva_cms/icons/assets/pdf.png +0 -0
  27. data/app/assets/images/adva_cms/icons/assets/video.png +0 -0
  28. data/app/assets/images/adva_cms/icons/attach.png +0 -0
  29. data/app/assets/images/adva_cms/icons/bin.png +0 -0
  30. data/app/assets/images/adva_cms/icons/bin_closed.png +0 -0
  31. data/app/assets/images/adva_cms/icons/bin_empty.png +0 -0
  32. data/app/assets/images/adva_cms/icons/bullet_black.png +0 -0
  33. data/app/assets/images/adva_cms/icons/bullet_delete.png +0 -0
  34. data/app/assets/images/adva_cms/icons/bullet_error.png +0 -0
  35. data/app/assets/images/adva_cms/icons/bullet_go.png +0 -0
  36. data/app/assets/images/adva_cms/icons/bullet_red.png +0 -0
  37. data/app/assets/images/adva_cms/icons/bullet_white.png +0 -0
  38. data/app/assets/images/adva_cms/icons/bullet_yellow.png +0 -0
  39. data/app/assets/images/adva_cms/icons/cancel.png +0 -0
  40. data/app/assets/images/adva_cms/icons/comment.gif +0 -0
  41. data/app/assets/images/adva_cms/icons/comment.png +0 -0
  42. data/app/assets/images/adva_cms/icons/comment_add.png +0 -0
  43. data/app/assets/images/adva_cms/icons/comment_blue.gif +0 -0
  44. data/app/assets/images/adva_cms/icons/comment_delete.png +0 -0
  45. data/app/assets/images/adva_cms/icons/comment_edit.png +0 -0
  46. data/app/assets/images/adva_cms/icons/comment_yellow.gif +0 -0
  47. data/app/assets/images/adva_cms/icons/cross.png +0 -0
  48. data/app/assets/images/adva_cms/icons/delete.png +0 -0
  49. data/app/assets/images/adva_cms/icons/eye.png +0 -0
  50. data/app/assets/images/adva_cms/icons/favorites.png +0 -0
  51. data/app/assets/images/adva_cms/icons/help.png +0 -0
  52. data/app/assets/images/adva_cms/icons/hourglass.png +0 -0
  53. data/app/assets/images/adva_cms/icons/icon_attachment.gif +0 -0
  54. data/app/assets/images/adva_cms/icons/icon_padlock.gif +0 -0
  55. data/app/assets/images/adva_cms/icons/link.png +0 -0
  56. data/app/assets/images/adva_cms/icons/lock.png +0 -0
  57. data/app/assets/images/adva_cms/icons/magnifier.png +0 -0
  58. data/app/assets/images/adva_cms/icons/minus.gif +0 -0
  59. data/app/assets/images/adva_cms/icons/page_add.png +0 -0
  60. data/app/assets/images/adva_cms/icons/page_delete.png +0 -0
  61. data/app/assets/images/adva_cms/icons/page_edit.png +0 -0
  62. data/app/assets/images/adva_cms/icons/page_favorites.png +0 -0
  63. data/app/assets/images/adva_cms/icons/page_go.png +0 -0
  64. data/app/assets/images/adva_cms/icons/page_green.png +0 -0
  65. data/app/assets/images/adva_cms/icons/page_red.png +0 -0
  66. data/app/assets/images/adva_cms/icons/page_white_add.png +0 -0
  67. data/app/assets/images/adva_cms/icons/page_white_delete.png +0 -0
  68. data/app/assets/images/adva_cms/icons/page_white_edit.png +0 -0
  69. data/app/assets/images/adva_cms/icons/page_white_go.png +0 -0
  70. data/app/assets/images/adva_cms/icons/page_white_link.png +0 -0
  71. data/app/assets/images/adva_cms/icons/page_white_magnify.png +0 -0
  72. data/app/assets/images/adva_cms/icons/pencil.png +0 -0
  73. data/app/assets/images/adva_cms/icons/star.png +0 -0
  74. data/app/assets/images/adva_cms/icons/stop.png +0 -0
  75. data/app/assets/images/adva_cms/icons/tag_green.png +0 -0
  76. data/app/assets/images/adva_cms/icons/tick.png +0 -0
  77. data/app/assets/images/adva_cms/icons/zoom.png +0 -0
  78. data/app/assets/images/adva_cms/indicator.gif +0 -0
  79. data/app/assets/images/adva_cms/preview.png +0 -0
  80. data/app/assets/images/adva_cms/rails.png +0 -0
  81. data/app/assets/images/adva_cms/sortable_tree/drag.png +0 -0
  82. data/app/assets/images/adva_cms/theme_selected.png +0 -0
  83. data/app/assets/javascripts/admin.js +1 -0
  84. data/app/assets/javascripts/adva_cms/admin/jquery.admin.js +23 -0
  85. data/app/assets/javascripts/adva_cms/admin/jquery.article.js +22 -0
  86. data/app/assets/javascripts/adva_cms/admin/jquery.cached_pages.js +14 -0
  87. data/app/assets/javascripts/adva_cms/admin/jquery.table_tree.js +7 -0
  88. data/app/assets/javascripts/adva_cms/application.js +14 -0
  89. data/app/assets/javascripts/adva_cms/base.js +4 -0
  90. data/app/assets/javascripts/adva_cms/cookie.js +49 -0
  91. data/app/assets/javascripts/adva_cms/jquery.common.js +41 -0
  92. data/app/assets/javascripts/adva_cms/jquery.dates.js +51 -0
  93. data/app/assets/javascripts/adva_cms/jquery.flash.js +57 -0
  94. data/app/assets/javascripts/adva_cms/jquery.roles.js +25 -0
  95. data/app/assets/javascripts/adva_cms/jquery/jquery-lowpro.js +224 -0
  96. data/app/assets/javascripts/adva_cms/jquery/jquery.qtip.js +2085 -0
  97. data/app/assets/javascripts/adva_cms/jquery/jquery.table_tree.js +307 -0
  98. data/app/assets/javascripts/adva_cms/jquery/jquery.tablednd_0_5.js +386 -0
  99. data/app/assets/javascripts/adva_cms/json.js +139 -0
  100. data/app/assets/stylesheets/admin.css +1 -0
  101. data/app/assets/stylesheets/adva_cms/admin.css +16 -0
  102. data/app/assets/stylesheets/adva_cms/admin/alternate/common.css +76 -0
  103. data/app/assets/stylesheets/adva_cms/admin/alternate/forms.css +121 -0
  104. data/app/assets/stylesheets/adva_cms/admin/alternate/header.css +125 -0
  105. data/app/assets/stylesheets/adva_cms/admin/alternate/layout.css +103 -0
  106. data/app/assets/stylesheets/adva_cms/admin/alternate/lists.css +153 -0
  107. data/app/assets/stylesheets/adva_cms/admin/alternate/sidebar.css +65 -0
  108. data/app/assets/stylesheets/adva_cms/admin/alternate/top.css +123 -0
  109. data/app/assets/stylesheets/adva_cms/admin/common.css +76 -0
  110. data/app/assets/stylesheets/adva_cms/admin/content.css +11 -0
  111. data/app/assets/stylesheets/adva_cms/admin/forms.css +116 -0
  112. data/app/assets/stylesheets/adva_cms/admin/header.css +114 -0
  113. data/app/assets/stylesheets/adva_cms/admin/helptip.css +35 -0
  114. data/app/assets/stylesheets/adva_cms/admin/layout.css +56 -0
  115. data/app/assets/stylesheets/adva_cms/admin/lists.css +152 -0
  116. data/app/assets/stylesheets/adva_cms/admin/projection.css +118 -0
  117. data/app/assets/stylesheets/adva_cms/admin/reset.css +25 -0
  118. data/app/assets/stylesheets/adva_cms/admin/screen/top.css +8 -0
  119. data/app/assets/stylesheets/adva_cms/admin/sidebar.css +67 -0
  120. data/app/assets/stylesheets/adva_cms/admin/themes.css +49 -0
  121. data/app/assets/stylesheets/adva_cms/admin/top.css +83 -0
  122. data/app/assets/stylesheets/adva_cms/admin/users.css +40 -0
  123. data/app/assets/stylesheets/adva_cms/common.css +49 -0
  124. data/app/assets/stylesheets/adva_cms/default.css +201 -0
  125. data/app/assets/stylesheets/adva_cms/forms.css +60 -0
  126. data/app/assets/stylesheets/adva_cms/jquery/alternate/jquery.tooltip.css +13 -0
  127. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  128. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  129. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  130. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  131. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  132. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  133. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  134. data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  135. data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_222222_256x240.png +0 -0
  136. data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
  137. data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_454545_256x240.png +0 -0
  138. data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_888888_256x240.png +0 -0
  139. data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
  140. data/app/assets/stylesheets/adva_cms/jquery/jquery-ui.css +406 -0
  141. data/app/assets/stylesheets/adva_cms/jquery/jquery.tooltip.css +10 -0
  142. data/app/assets/stylesheets/adva_cms/layout/login.css +8 -0
  143. data/app/assets/stylesheets/adva_cms/layout/simple.css +8 -0
  144. data/app/assets/stylesheets/adva_cms/menu.css +129 -0
  145. data/app/assets/stylesheets/adva_cms/reset.css +25 -0
  146. data/app/controllers/admin/base_controller.rb +101 -0
  147. data/app/controllers/admin/categories_controller.rb +3 -0
  148. data/app/controllers/admin/install_controller.rb +61 -0
  149. data/app/controllers/admin/page/articles_controller.rb +150 -0
  150. data/app/controllers/admin/page/categories_controller.rb +62 -0
  151. data/app/controllers/admin/page/contents_controller.rb +52 -0
  152. data/app/controllers/admin/page/links_controller.rb +69 -0
  153. data/app/controllers/admin/pages_controller.rb +2 -0
  154. data/app/controllers/admin/plugins_controller.rb +40 -0
  155. data/app/controllers/admin/sections_controller.rb +91 -0
  156. data/app/controllers/admin/sites_controller.rb +99 -0
  157. data/app/controllers/articles_controller.rb +81 -0
  158. data/app/controllers/base_controller.rb +82 -0
  159. data/app/helpers/admin/base_helper.rb +106 -0
  160. data/app/helpers/base_helper.rb +56 -0
  161. data/app/helpers/content_helper.rb +90 -0
  162. data/app/helpers/resource_helper.rb +127 -0
  163. data/app/models/article.rb +40 -0
  164. data/app/models/categorization.rb +4 -0
  165. data/app/models/category.rb +60 -0
  166. data/app/models/content.rb +155 -0
  167. data/app/models/event.rb +34 -0
  168. data/app/models/link.rb +4 -0
  169. data/app/models/page.rb +36 -0
  170. data/app/models/section.rb +126 -0
  171. data/app/models/site.rb +104 -0
  172. data/app/views/admin/cached_pages/_filter.html.erb +8 -0
  173. data/app/views/admin/cached_pages/destroy.js.erb +18 -0
  174. data/app/views/admin/cached_pages/index.html.erb +26 -0
  175. data/app/views/admin/install/confirmation.html.erb +10 -0
  176. data/app/views/admin/install/index.html.erb +38 -0
  177. data/app/views/admin/page/articles/_form.html.erb +40 -0
  178. data/app/views/admin/page/articles/_options.html.erb +20 -0
  179. data/app/views/admin/page/articles/edit.html.erb +15 -0
  180. data/app/views/admin/page/articles/new.html.erb +12 -0
  181. data/app/views/admin/page/categories/edit.html.erb +22 -0
  182. data/app/views/admin/page/categories/index.html.erb +23 -0
  183. data/app/views/admin/page/categories/new.html.erb +19 -0
  184. data/app/views/admin/page/contents/index.html.erb +40 -0
  185. data/app/views/admin/page/links/_form.html.erb +26 -0
  186. data/app/views/admin/page/links/_options.html.erb +23 -0
  187. data/app/views/admin/page/links/edit.html.erb +12 -0
  188. data/app/views/admin/page/links/new.html.erb +12 -0
  189. data/app/views/admin/plugins/_form.html.erb +11 -0
  190. data/app/views/admin/plugins/index.html.erb +16 -0
  191. data/app/views/admin/plugins/show.html.erb +43 -0
  192. data/app/views/admin/sections/_form.html.haml +20 -0
  193. data/app/views/admin/sections/edit.html.haml +6 -0
  194. data/app/views/admin/sections/index.html.erb +27 -0
  195. data/app/views/admin/sections/new.html.erb +29 -0
  196. data/app/views/admin/sections/settings/_page.html.haml +10 -0
  197. data/app/views/admin/shared/_header.html.erb +18 -0
  198. data/app/views/admin/shared/_language_select.html.erb +6 -0
  199. data/app/views/admin/shared/_section.html.erb +8 -0
  200. data/app/views/admin/shared/_section_summary.html.erb +23 -0
  201. data/app/views/admin/shared/_section_tree.html.erb +23 -0
  202. data/app/views/admin/sites/_email_notifications.html.erb +9 -0
  203. data/app/views/admin/sites/_form.html.erb +15 -0
  204. data/app/views/admin/sites/_recent_users.html.erb +11 -0
  205. data/app/views/admin/sites/_sections.html.erb +10 -0
  206. data/app/views/admin/sites/_unapproved_comments.html.erb +10 -0
  207. data/app/views/admin/sites/edit.html.erb +4 -0
  208. data/app/views/admin/sites/index.html.erb +21 -0
  209. data/app/views/admin/sites/multi_sites_disabled.html.erb +11 -0
  210. data/app/views/admin/sites/new.html.erb +21 -0
  211. data/app/views/admin/sites/show.html.erb +16 -0
  212. data/app/views/categories/_checkboxes.html.erb +12 -0
  213. data/app/views/layouts/admin.html.haml +50 -0
  214. data/app/views/layouts/default.html.erb +38 -0
  215. data/app/views/layouts/simple.html.erb +22 -0
  216. data/app/views/pages/articles/index.html.erb +10 -0
  217. data/app/views/pages/articles/show.html.erb +17 -0
  218. data/app/views/shared/_flash.html.erb +3 -0
  219. data/app/views/shared/_footer.html.erb +4 -0
  220. data/app/views/shared/_menu.html.erb +10 -0
  221. data/app/views/shared/_sidebar.html.erb +19 -0
  222. data/app/views/shared/messages/insufficient_permissions.html.erb +4 -0
  223. data/config/environment.rb +21 -0
  224. data/config/initializers/has_options.rb +2 -0
  225. data/config/initializers/has_permalink.rb +27 -0
  226. data/config/initializers/mailer.rb +12 -0
  227. data/config/initializers/menus.rb +184 -0
  228. data/config/initializers/roles.rb +91 -0
  229. data/config/initializers/settings.rb +26 -0
  230. data/config/initializers/site.rb +5 -0
  231. data/config/initializers/translations_are_a_pain.rb +9 -0
  232. data/config/locales/en.yml +1295 -0
  233. data/config/routes.rb +47 -0
  234. data/db/migrate/20080401000001_create_sites_table.rb +28 -0
  235. data/db/migrate/20080401000002_create_sections_table.rb +25 -0
  236. data/db/migrate/20080401000003_create_contents_table.rb +35 -0
  237. data/db/migrate/20080401000004_create_categories_table.rb +17 -0
  238. data/db/migrate/20080401000005_create_category_assignments.rb +12 -0
  239. data/db/migrate/20080401000006_create_taggable_tables.rb +26 -0
  240. data/db/migrate/20080710000000_create_plugin_configs.rb +13 -0
  241. data/db/migrate/20080715131051_plugin_owner_column.rb +13 -0
  242. data/db/migrate/20081208161500_add_content_type_to_join_tables.rb +10 -0
  243. data/db/migrate/20090216114034_rename_category_assignment_to_categorization.rb +13 -0
  244. data/db/migrate/20090305123429_move_sections_to_pages.rb +9 -0
  245. data/db/migrate/20090519132700_add_published_at_to_sections.rb +10 -0
  246. data/db/migrate/20090702085459_create_section_translations.rb +9 -0
  247. data/db/migrate/20090702200226_create_category_translations.rb +9 -0
  248. data/db/migrate/20090707171100_upgrade_paperclip_paths.rb +31 -0
  249. data/db/migrate/20090709111934_add_email_notification_to_site.rb +12 -0
  250. data/db/migrate/20091026000906_add_nesting_to_articles.rb +26 -0
  251. data/db/migrate/20140721000000_add_title_to_contents.rb +7 -0
  252. data/lib/adva_cms.rb +50 -0
  253. data/lib/adva_cms/version.rb +3 -0
  254. data/lib/core_ext.rb +7 -0
  255. data/lib/extensible_forms.rb +283 -0
  256. data/lib/has_options.rb +46 -0
  257. data/lib/html_diff.rb +48 -0
  258. data/lib/rails_ext.rb +15 -0
  259. data/lib/rails_ext/action_controller/cacheable_flash.rb +30 -0
  260. data/lib/rails_ext/action_controller/content_for_assignments.rb +105 -0
  261. data/lib/rails_ext/action_controller/default_params.rb +19 -0
  262. data/lib/rails_ext/action_controller/event_helper.rb +18 -0
  263. data/lib/rails_ext/action_controller/page_caching.rb +23 -0
  264. data/lib/rails_ext/action_controller/render_with_error_proc.rb +46 -0
  265. data/lib/rails_ext/action_controller/responds_to_parent.rb +46 -0
  266. data/lib/rails_ext/action_controller/url_for_returning.rb +12 -0
  267. data/lib/rails_ext/active_record/exists.rb +5 -0
  268. data/lib/rails_ext/active_record/sti_instantiation.rb +35 -0
  269. data/lib/rails_ext/active_record/sticky_changes.rb +30 -0
  270. data/lib/rails_ext/railties/plugin.rb +58 -0
  271. data/lib/rails_ext/railties/plugin_configuration.rb +72 -0
  272. data/lib/rails_ext/railties/plugin_initializers.rb +25 -0
  273. data/lib/registry.rb +49 -0
  274. data/lib/tasks/adva_cms.rake +178 -0
  275. data/lib/tasks/translation.rake +69 -0
  276. data/lib/time_hacks.rb +57 -0
  277. data/lib/webrat_patch.rb +11 -0
  278. data/locale/rails/fr.yml +123 -0
  279. data/test/NOTES +56 -0
  280. data/test/contexts.rb +365 -0
  281. data/test/fixtures.rb +190 -0
  282. data/test/fixtures/templates/alternative_templates/index.html.erb +1 -0
  283. data/test/fixtures/templates/context_templates_test/index.html.erb +1 -0
  284. data/test/fixtures/templates/context_templates_test/show.html.erb +0 -0
  285. data/test/fixtures/templates/layouts/alternative.html.erb +0 -0
  286. data/test/fixtures/templates/layouts/default.html.erb +0 -0
  287. data/test/fixtures/templates/menu/shared/_menu.html.erb +8 -0
  288. data/test/functional/admin/articles_controller_test.rb +329 -0
  289. data/test/functional/admin/base_controller_test.rb +68 -0
  290. data/test/functional/admin/cached_pages_controller_test.rb +66 -0
  291. data/test/functional/admin/categories_controller_test.rb +164 -0
  292. data/test/functional/admin/cells_controller_spec.rb +32 -0
  293. data/test/functional/admin/install_controller_test.rb +89 -0
  294. data/test/functional/admin/plugins_controller_test.rb +93 -0
  295. data/test/functional/admin/sections_controller_test.rb +201 -0
  296. data/test/functional/admin/sites_controller_test.rb +240 -0
  297. data/test/functional/asset_tag_expansions_test.rb +82 -0
  298. data/test/functional/base_controller_test.rb +73 -0
  299. data/test/functional/page_articles_controller_test.rb +168 -0
  300. data/test/functional/page_articles_routes_test.rb +73 -0
  301. data/test/integration/admin/cached_pages_test.rb +43 -0
  302. data/test/integration/admin/categories_test.rb +66 -0
  303. data/test/integration/admin/custom_templates_test.rb +42 -0
  304. data/test/integration/admin/filtering_articles_test.rb +32 -0
  305. data/test/integration/admin/plugins.rb +32 -0
  306. data/test/integration/admin/section_article_test.rb +150 -0
  307. data/test/integration/admin/section_test.rb +88 -0
  308. data/test/integration/admin/sites_test.rb +48 -0
  309. data/test/integration/installation_test.rb +109 -0
  310. data/test/integration/page_article_comment_test.rb +51 -0
  311. data/test/integration/page_article_test.rb +87 -0
  312. data/test/integration/section_index_test.rb +37 -0
  313. data/test/javascript/assets/jquery-lowpro.js +224 -0
  314. data/test/javascript/assets/jquery-ui.js +298 -0
  315. data/test/javascript/assets/jquery.js +4376 -0
  316. data/test/javascript/assets/testrunner.js +815 -0
  317. data/test/javascript/assets/testsuite.css +120 -0
  318. data/test/javascript/lib/jstest.rb +588 -0
  319. data/test/javascript/templates/test_case.erb +33 -0
  320. data/test/plugins/adva_context_templates/context_templates_test.rb +138 -0
  321. data/test/plugins/adva_post_ping/controller/integration_test.rb +78 -0
  322. data/test/plugins/adva_post_ping/post_ping_test.rb +94 -0
  323. data/test/plugins/adva_url_history/article_test.rb +94 -0
  324. data/test/plugins/adva_url_history/init_url_history.rb +18 -0
  325. data/test/plugins/adva_url_history/section_test.rb +49 -0
  326. data/test/test_helper.rb +75 -0
  327. data/test/test_helper/clear_directories.rb +16 -0
  328. data/test/test_helper/ensure_single_site_mode.rb +10 -0
  329. data/test/test_helper/extensions/cacheable_flash.rb +14 -0
  330. data/test/test_helper/extensions/cronjob.rb +11 -0
  331. data/test/test_helper/extensions/even_test_log.rb +21 -0
  332. data/test/test_helper/extensions/integration_test.rb +78 -0
  333. data/test/test_helper/extensions/matchy.rb +365 -0
  334. data/test/test_helper/extensions/matchy_adva_cms.rb +441 -0
  335. data/test/test_helper/extensions/rails_patch.rb +40 -0
  336. data/test/test_helper/extensions/rr.rb +7 -0
  337. data/test/test_helper/extensions/test_unit.rb +35 -0
  338. data/test/test_helper/extensions/with_sugar.rb +166 -0
  339. data/test/test_helper/parse_options.rb +18 -0
  340. data/test/test_helper/setup_db_transaction.rb +15 -0
  341. data/test/test_helper/setup_webrat.rb +9 -0
  342. data/test/test_helper/test_server/init.rb +15 -0
  343. data/test/unit/helpers/admin/base_helper_test.rb +139 -0
  344. data/test/unit/helpers/base_helper_spec.rb +54 -0
  345. data/test/unit/helpers/base_helper_test.rb +165 -0
  346. data/test/unit/helpers/content_helper_test.rb +127 -0
  347. data/test/unit/helpers/resource_helper_test.rb +180 -0
  348. data/test/unit/i18n_test.rb +22 -0
  349. data/test/unit/lib/cells_ext_spec.rb +96 -0
  350. data/test/unit/lib/extensible_forms_test.rb +362 -0
  351. data/test/unit/lib/menu_test.rb +119 -0
  352. data/test/unit/lib/rails_ext/content_for_assignments_test.rb +75 -0
  353. data/test/unit/lib/rails_ext/plugin_configuration_test.rb +40 -0
  354. data/test/unit/lib/rails_ext/sticky_changes_test.rb +33 -0
  355. data/test/unit/lib/registry_test.rb +91 -0
  356. data/test/unit/lib/routing_filter/routing_filter_categories_spec.rb +63 -0
  357. data/test/unit/lib/routing_filter/routing_filter_categories_test.rb +159 -0
  358. data/test/unit/lib/routing_filter/routing_filter_locale_spec.rb +73 -0
  359. data/test/unit/lib/routing_filter/routing_filter_root_blog_archive_spec.rb +40 -0
  360. data/test/unit/lib/routing_filter/routing_filter_root_section_articles_spec.rb +48 -0
  361. data/test/unit/lib/routing_filter/routing_filter_root_wikipages_spec.rb +40 -0
  362. data/test/unit/lib/routing_filter/routing_filter_sections_spec.rb +143 -0
  363. data/test/unit/lib/routing_filter/routing_filter_sections_test.rb +32 -0
  364. data/test/unit/lib/routing_filter/routing_filter_sets_test.rb +86 -0
  365. data/test/unit/models/article_test.rb +191 -0
  366. data/test/unit/models/category_test.rb +68 -0
  367. data/test/unit/models/content_test.rb +409 -0
  368. data/test/unit/models/counter_test.rb +43 -0
  369. data/test/unit/models/event_test.rb +41 -0
  370. data/test/unit/models/nested_categories_test.rb +34 -0
  371. data/test/unit/models/page_test.rb +63 -0
  372. data/test/unit/models/section_test.rb +315 -0
  373. data/test/unit/models/site_test.rb +199 -0
  374. data/test/unit/observers/activities_article_observer_test.rb +42 -0
  375. data/vendor/gems/belongs_to_cacheable/.gitignore +17 -0
  376. data/vendor/gems/belongs_to_cacheable/Gemfile +4 -0
  377. data/vendor/gems/belongs_to_cacheable/LICENSE +22 -0
  378. data/vendor/gems/belongs_to_cacheable/README.md +29 -0
  379. data/vendor/gems/belongs_to_cacheable/Rakefile +2 -0
  380. data/vendor/gems/belongs_to_cacheable/belongs_to_cacheable.gemspec +22 -0
  381. data/vendor/gems/belongs_to_cacheable/init.rb +1 -0
  382. data/vendor/gems/belongs_to_cacheable/lib/active_record/belongs_to_cacheable.rb +77 -0
  383. data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable.rb +3 -0
  384. data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable/version.rb +3 -0
  385. data/vendor/gems/belongs_to_cacheable/spec/belongs_to_cacheable_spec.rb +52 -0
  386. data/vendor/gems/belongs_to_cacheable/spec/spec_helper.rb +50 -0
  387. data/vendor/gems/filtered_column/.gitignore +17 -0
  388. data/vendor/gems/filtered_column/Gemfile +4 -0
  389. data/vendor/gems/filtered_column/LICENSE +22 -0
  390. data/vendor/gems/filtered_column/README +4 -0
  391. data/vendor/gems/filtered_column/README.md +29 -0
  392. data/vendor/gems/filtered_column/Rakefile +23 -0
  393. data/vendor/gems/filtered_column/filtered_column.gemspec +17 -0
  394. data/vendor/gems/filtered_column/lib/filtered_column.rb +17 -0
  395. data/vendor/gems/filtered_column/lib/filtered_column/filters/base.rb +28 -0
  396. data/vendor/gems/filtered_column/lib/filtered_column/filters/smartypants_filter.rb +14 -0
  397. data/vendor/gems/filtered_column/lib/filtered_column/filters/textile_filter.rb +13 -0
  398. data/vendor/gems/filtered_column/lib/filtered_column/macros/base.rb +25 -0
  399. data/vendor/gems/filtered_column/lib/filtered_column/mixin.rb +46 -0
  400. data/vendor/gems/filtered_column/lib/filtered_column/processor.rb +52 -0
  401. data/vendor/gems/filtered_column/lib/filtered_column/version.rb +3 -0
  402. data/vendor/gems/filtered_column/tasks/filtered_column_tasks.rake +4 -0
  403. data/vendor/gems/filtered_column/test/abstract_unit.rb +73 -0
  404. data/vendor/gems/filtered_column/test/filtered_column_test.rb +53 -0
  405. data/vendor/gems/filtered_column/test/macro_filter_test.rb +23 -0
  406. data/vendor/gems/has_counter/.gitignore +17 -0
  407. data/vendor/gems/has_counter/Gemfile +4 -0
  408. data/vendor/gems/has_counter/LICENSE +22 -0
  409. data/vendor/gems/has_counter/MIT-LICENSE +20 -0
  410. data/vendor/gems/has_counter/README.markdown +64 -0
  411. data/vendor/gems/has_counter/README.md +29 -0
  412. data/vendor/gems/has_counter/Rakefile +2 -0
  413. data/vendor/gems/has_counter/db/migrate/20080601194338_create_counters_table.rb.rb +13 -0
  414. data/vendor/gems/has_counter/has_counter.gemspec +17 -0
  415. data/vendor/gems/has_counter/lib/active_record/has_counter.rb +64 -0
  416. data/vendor/gems/has_counter/lib/counter.rb +23 -0
  417. data/vendor/gems/has_counter/lib/has_counter.rb +4 -0
  418. data/vendor/gems/has_counter/lib/has_counter/version.rb +3 -0
  419. data/vendor/gems/has_counter/spec/has_counter.spec.log +0 -0
  420. data/vendor/gems/has_counter/spec/has_counter.sqlite3.db +0 -0
  421. data/vendor/gems/has_counter/spec/has_counter_spec.rb +55 -0
  422. data/vendor/gems/has_counter/spec/spec_helper.rb +117 -0
  423. data/vendor/gems/has_filter/.gitignore +17 -0
  424. data/vendor/gems/has_filter/Gemfile +4 -0
  425. data/vendor/gems/has_filter/LICENSE +22 -0
  426. data/vendor/gems/has_filter/README.md +29 -0
  427. data/vendor/gems/has_filter/Rakefile +2 -0
  428. data/vendor/gems/has_filter/app/assets/images/has_filter/filter_add.png +0 -0
  429. data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_left.png +0 -0
  430. data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_right.png +0 -0
  431. data/vendor/gems/has_filter/app/assets/images/has_filter/filter_remove.png +0 -0
  432. data/vendor/gems/has_filter/app/assets/javascripts/has_filter/filter.js +35 -0
  433. data/vendor/gems/has_filter/app/assets/javascripts/has_filter/jquery.filter.js +23 -0
  434. data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/alternate/filter.css +102 -0
  435. data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/filter.css +100 -0
  436. data/vendor/gems/has_filter/app/helpers/filter_helper.rb +3 -0
  437. data/vendor/gems/has_filter/has_filter.gemspec +17 -0
  438. data/vendor/gems/has_filter/init.rb +3 -0
  439. data/vendor/gems/has_filter/lib/has_filter.rb +22 -0
  440. data/vendor/gems/has_filter/lib/has_filter/active_record/act_macro.rb +102 -0
  441. data/vendor/gems/has_filter/lib/has_filter/filter.rb +17 -0
  442. data/vendor/gems/has_filter/lib/has_filter/filter/base.rb +67 -0
  443. data/vendor/gems/has_filter/lib/has_filter/filter/categorized.rb +24 -0
  444. data/vendor/gems/has_filter/lib/has_filter/filter/chain.rb +45 -0
  445. data/vendor/gems/has_filter/lib/has_filter/filter/set.rb +80 -0
  446. data/vendor/gems/has_filter/lib/has_filter/filter/state.rb +25 -0
  447. data/vendor/gems/has_filter/lib/has_filter/filter/tagged.rb +22 -0
  448. data/vendor/gems/has_filter/lib/has_filter/filter/text.rb +55 -0
  449. data/vendor/gems/has_filter/lib/has_filter/version.rb +3 -0
  450. data/vendor/gems/has_filter/test/db/setup.rb +45 -0
  451. data/vendor/gems/has_filter/test/db/test.sqlite3.db +0 -0
  452. data/vendor/gems/has_filter/test/fixtures.rb +15 -0
  453. data/vendor/gems/has_filter/test/has_filter/filter_chain_test.rb +41 -0
  454. data/vendor/gems/has_filter/test/has_filter/filter_scopes_test.rb +102 -0
  455. data/vendor/gems/has_filter/test/has_filter/filter_tags_test.rb +113 -0
  456. data/vendor/gems/has_filter/test/has_filter/integration.rb +15 -0
  457. data/vendor/gems/has_filter/test/has_filter/scopes_test.rb +48 -0
  458. data/vendor/gems/has_filter/test/log/test.log +34346 -0
  459. data/vendor/gems/has_filter/test/models.rb +23 -0
  460. data/vendor/gems/has_filter/test/templates/has_filter/test/index.html.erb +5 -0
  461. data/vendor/gems/has_filter/test/test_helper.rb +66 -0
  462. data/vendor/gems/simple_taggable/.gitignore +17 -0
  463. data/vendor/gems/simple_taggable/Gemfile +4 -0
  464. data/vendor/gems/simple_taggable/LICENSE +22 -0
  465. data/vendor/gems/simple_taggable/README +24 -0
  466. data/vendor/gems/simple_taggable/README.md +29 -0
  467. data/vendor/gems/simple_taggable/Rakefile +2 -0
  468. data/vendor/gems/simple_taggable/lib/simple_taggable.rb +153 -0
  469. data/vendor/gems/simple_taggable/lib/simple_taggable/version.rb +3 -0
  470. data/vendor/gems/simple_taggable/lib/tag.rb +31 -0
  471. data/vendor/gems/simple_taggable/lib/tag_list.rb +90 -0
  472. data/vendor/gems/simple_taggable/lib/tagging.rb +8 -0
  473. data/vendor/gems/simple_taggable/simple_taggable.gemspec +17 -0
  474. data/vendor/gems/simple_taggable/test/db/schema.rb +41 -0
  475. data/vendor/gems/simple_taggable/test/db/simple_taggable.sqlite3.db +0 -0
  476. data/vendor/gems/simple_taggable/test/fixtures/magazine.rb +3 -0
  477. data/vendor/gems/simple_taggable/test/fixtures/magazines.yml +2 -0
  478. data/vendor/gems/simple_taggable/test/fixtures/photo.rb +8 -0
  479. data/vendor/gems/simple_taggable/test/fixtures/photos.yml +19 -0
  480. data/vendor/gems/simple_taggable/test/fixtures/post.rb +5 -0
  481. data/vendor/gems/simple_taggable/test/fixtures/posts.yml +27 -0
  482. data/vendor/gems/simple_taggable/test/fixtures/subscription.rb +4 -0
  483. data/vendor/gems/simple_taggable/test/fixtures/subscriptions.yml +3 -0
  484. data/vendor/gems/simple_taggable/test/fixtures/taggings.yml +112 -0
  485. data/vendor/gems/simple_taggable/test/fixtures/tags.yml +14 -0
  486. data/vendor/gems/simple_taggable/test/fixtures/user.rb +6 -0
  487. data/vendor/gems/simple_taggable/test/fixtures/users.yml +5 -0
  488. data/vendor/gems/simple_taggable/test/log/simple_taggable.log +1614 -0
  489. data/vendor/gems/simple_taggable/test/simple_taggable_test.rb +226 -0
  490. data/vendor/gems/simple_taggable/test/tag_list_test.rb +105 -0
  491. data/vendor/gems/simple_taggable/test/test_helper.rb +80 -0
  492. data/vendor/gems/table_builder/.gitignore +17 -0
  493. data/vendor/gems/table_builder/Gemfile +4 -0
  494. data/vendor/gems/table_builder/LICENSE +22 -0
  495. data/vendor/gems/table_builder/README.md +29 -0
  496. data/vendor/gems/table_builder/Rakefile +2 -0
  497. data/vendor/gems/table_builder/lib/table_builder.rb +27 -0
  498. data/vendor/gems/table_builder/lib/table_builder/body.rb +28 -0
  499. data/vendor/gems/table_builder/lib/table_builder/cell.rb +21 -0
  500. data/vendor/gems/table_builder/lib/table_builder/column.rb +26 -0
  501. data/vendor/gems/table_builder/lib/table_builder/foot.rb +6 -0
  502. data/vendor/gems/table_builder/lib/table_builder/head.rb +16 -0
  503. data/vendor/gems/table_builder/lib/table_builder/row.rb +40 -0
  504. data/vendor/gems/table_builder/lib/table_builder/rows.rb +26 -0
  505. data/vendor/gems/table_builder/lib/table_builder/table.rb +75 -0
  506. data/vendor/gems/table_builder/lib/table_builder/tag.rb +58 -0
  507. data/vendor/gems/table_builder/lib/table_builder/version.rb +3 -0
  508. data/vendor/gems/table_builder/table_builder.gemspec +17 -0
  509. data/vendor/gems/table_builder/test/fixtures/templates/table_all.html.erb +20 -0
  510. data/vendor/gems/table_builder/test/fixtures/templates/table_auto_body.html.erb +3 -0
  511. data/vendor/gems/table_builder/test/fixtures/templates/table_auto_columns.html.erb +1 -0
  512. data/vendor/gems/table_builder/test/fixtures/templates/table_simple.html.erb +7 -0
  513. data/vendor/gems/table_builder/test/table_builder/table_test.rb +230 -0
  514. data/vendor/gems/table_builder/test/test_helper.rb +49 -0
  515. data/vendor/gems/tags/.gitignore +17 -0
  516. data/vendor/gems/tags/Gemfile +4 -0
  517. data/vendor/gems/tags/LICENSE +22 -0
  518. data/vendor/gems/tags/README.md +29 -0
  519. data/vendor/gems/tags/Rakefile +2 -0
  520. data/vendor/gems/tags/lib/breadcrumbs.rb +13 -0
  521. data/vendor/gems/tags/lib/menu.rb +179 -0
  522. data/vendor/gems/tags/lib/menu/builder.rb +74 -0
  523. data/vendor/gems/tags/lib/tags.rb +7 -0
  524. data/vendor/gems/tags/lib/tags/tag.rb +125 -0
  525. data/vendor/gems/tags/lib/tags/version.rb +3 -0
  526. data/vendor/gems/tags/tags.gemspec +17 -0
  527. data/vendor/gems/tags/test/tags/menu_test.rb +173 -0
  528. data/vendor/gems/tags/test/tags/tag_test.rb +13 -0
  529. data/vendor/gems/tags/test/test_helper.rb +18 -0
  530. data/vendor/gems/xss_terminate/.gitignore +17 -0
  531. data/vendor/gems/xss_terminate/Gemfile +4 -0
  532. data/vendor/gems/xss_terminate/LICENSE +22 -0
  533. data/vendor/gems/xss_terminate/MIT-LICENSE +20 -0
  534. data/vendor/gems/xss_terminate/README +94 -0
  535. data/vendor/gems/xss_terminate/README.md +29 -0
  536. data/vendor/gems/xss_terminate/Rakefile +23 -0
  537. data/vendor/gems/xss_terminate/lib/html5lib_sanitize.rb +2453 -0
  538. data/vendor/gems/xss_terminate/lib/rails_sanitize.rb +8 -0
  539. data/vendor/gems/xss_terminate/lib/xss_terminate.rb +141 -0
  540. data/vendor/gems/xss_terminate/lib/xss_terminate/version.rb +3 -0
  541. data/vendor/gems/xss_terminate/tasks/xss_terminate_tasks.rake +7 -0
  542. data/vendor/gems/xss_terminate/test/models/comment.rb +5 -0
  543. data/vendor/gems/xss_terminate/test/models/entry.rb +7 -0
  544. data/vendor/gems/xss_terminate/test/models/message.rb +3 -0
  545. data/vendor/gems/xss_terminate/test/models/person.rb +5 -0
  546. data/vendor/gems/xss_terminate/test/models/review.rb +5 -0
  547. data/vendor/gems/xss_terminate/test/schema.rb +34 -0
  548. data/vendor/gems/xss_terminate/test/setup_test.rb +16 -0
  549. data/vendor/gems/xss_terminate/test/xss_terminate_test.rb +50 -0
  550. data/vendor/gems/xss_terminate/xss_terminate.gemspec +17 -0
  551. metadata +744 -0
@@ -0,0 +1,815 @@
1
+ /*
2
+ * QUnit - jQuery unit testrunner
3
+ *
4
+ * http://docs.jquery.com/QUnit
5
+ *
6
+ * Copyright (c) 2008 John Resig, Jörn Zaefferer
7
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
8
+ * and GPL (GPL-LICENSE.txt) licenses.
9
+ *
10
+ * $Id: testrunner.js 6173 2009-02-02 20:09:32Z jeresig $
11
+ */
12
+
13
+ (function($) {
14
+
15
+ // Tests for equality any JavaScript type and structure without unexpected results.
16
+ // Discussions and reference: http://philrathe.com/articles/equiv
17
+ // Test suites: http://philrathe.com/tests/equiv
18
+ // Author: Philippe Rathé <prathe@gmail.com>
19
+ var equiv = function () {
20
+
21
+ var innerEquiv; // the real equiv function
22
+ var callers = []; // stack to decide between skip/abort functions
23
+
24
+ // Determine what is o.
25
+ function hoozit(o) {
26
+ if (typeof o === "string") {
27
+ return "string";
28
+
29
+ } else if (typeof o === "boolean") {
30
+ return "boolean";
31
+
32
+ } else if (typeof o === "number") {
33
+
34
+ if (isNaN(o)) {
35
+ return "nan";
36
+ } else {
37
+ return "number";
38
+ }
39
+
40
+ } else if (typeof o === "undefined") {
41
+ return "undefined";
42
+
43
+ // consider: typeof null === object
44
+ } else if (o === null) {
45
+ return "null";
46
+
47
+ // consider: typeof [] === object
48
+ } else if (o instanceof Array) {
49
+ return "array";
50
+
51
+ // consider: typeof new Date() === object
52
+ } else if (o instanceof Date) {
53
+ return "date";
54
+
55
+ // consider: /./ instanceof Object;
56
+ // /./ instanceof RegExp;
57
+ // typeof /./ === "function"; // => false in IE and Opera,
58
+ // true in FF and Safari
59
+ } else if (o instanceof RegExp) {
60
+ return "regexp";
61
+
62
+ } else if (typeof o === "object") {
63
+ return "object";
64
+
65
+ } else if (o instanceof Function) {
66
+ return "function";
67
+ }
68
+ }
69
+
70
+ // Call the o related callback with the given arguments.
71
+ function bindCallbacks(o, callbacks, args) {
72
+ var prop = hoozit(o);
73
+ if (prop) {
74
+ if (hoozit(callbacks[prop]) === "function") {
75
+ return callbacks[prop].apply(callbacks, args);
76
+ } else {
77
+ return callbacks[prop]; // or undefined
78
+ }
79
+ }
80
+ }
81
+
82
+ var callbacks = function () {
83
+
84
+ // for string, boolean, number and null
85
+ function useStrictEquality(b, a) {
86
+ return a === b;
87
+ }
88
+
89
+ return {
90
+ "string": useStrictEquality,
91
+ "boolean": useStrictEquality,
92
+ "number": useStrictEquality,
93
+ "null": useStrictEquality,
94
+ "undefined": useStrictEquality,
95
+
96
+ "nan": function (b) {
97
+ return isNaN(b);
98
+ },
99
+
100
+ "date": function (b, a) {
101
+ return hoozit(b) === "date" && a.valueOf() === b.valueOf();
102
+ },
103
+
104
+ "regexp": function (b, a) {
105
+ return hoozit(b) === "regexp" &&
106
+ a.source === b.source && // the regex itself
107
+ a.global === b.global && // and its modifers (gmi) ...
108
+ a.ignoreCase === b.ignoreCase &&
109
+ a.multiline === b.multiline;
110
+ },
111
+
112
+ // - skip when the property is a method of an instance (OOP)
113
+ // - abort otherwise,
114
+ // initial === would have catch identical references anyway
115
+ "function": function () {
116
+ var caller = callers[callers.length - 1];
117
+ return caller !== Object &&
118
+ typeof caller !== "undefined";
119
+ },
120
+
121
+ "array": function (b, a) {
122
+ var i;
123
+ var len;
124
+
125
+ // b could be an object literal here
126
+ if ( ! (hoozit(b) === "array")) {
127
+ return false;
128
+ }
129
+
130
+ len = a.length;
131
+ if (len !== b.length) { // safe and faster
132
+ return false;
133
+ }
134
+ for (i = 0; i < len; i++) {
135
+ if( ! innerEquiv(a[i], b[i])) {
136
+ return false;
137
+ }
138
+ }
139
+ return true;
140
+ },
141
+
142
+ "object": function (b, a) {
143
+ var i;
144
+ var eq = true; // unless we can proove it
145
+ var aProperties = [], bProperties = []; // collection of strings
146
+
147
+ // comparing constructors is more strict than using instanceof
148
+ if ( a.constructor !== b.constructor) {
149
+ return false;
150
+ }
151
+
152
+ // stack constructor before traversing properties
153
+ callers.push(a.constructor);
154
+
155
+ for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
156
+
157
+ aProperties.push(i); // collect a's properties
158
+
159
+ if ( ! innerEquiv(a[i], b[i])) {
160
+ eq = false;
161
+ }
162
+ }
163
+
164
+ callers.pop(); // unstack, we are done
165
+
166
+ for (i in b) {
167
+ bProperties.push(i); // collect b's properties
168
+ }
169
+
170
+ // Ensures identical properties name
171
+ return eq && innerEquiv(aProperties.sort(), bProperties.sort());
172
+ }
173
+ };
174
+ }();
175
+
176
+ innerEquiv = function () { // can take multiple arguments
177
+ var args = Array.prototype.slice.apply(arguments);
178
+ if (args.length < 2) {
179
+ return true; // end transition
180
+ }
181
+
182
+ return (function (a, b) {
183
+ if (a === b) {
184
+ return true; // catch the most you can
185
+
186
+ } else if (typeof a !== typeof b || a === null || b === null || typeof a === "undefined" || typeof b === "undefined") {
187
+ return false; // don't lose time with error prone cases
188
+
189
+ } else {
190
+ return bindCallbacks(a, callbacks, [b, a]);
191
+ }
192
+
193
+ // apply transition with (1..n) arguments
194
+ })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
195
+ };
196
+
197
+ return innerEquiv;
198
+ }(); // equiv
199
+
200
+ var GETParams = $.map( location.search.slice(1).split('&'), decodeURIComponent ),
201
+ ngindex = $.inArray("noglobals", GETParams),
202
+ noglobals = ngindex !== -1;
203
+
204
+ if( noglobals )
205
+ GETParams.splice( ngindex, 1 );
206
+
207
+ var config = {
208
+ stats: {
209
+ all: 0,
210
+ bad: 0,
211
+ modules: 0,
212
+ tests: 0,
213
+ errors: 0
214
+ },
215
+ queue: [],
216
+ // block until document ready
217
+ blocking: true,
218
+ //restrict modules/tests by get parameters
219
+ // filters: GETParams,
220
+ // Made compatible with jstest.rb
221
+ filters: $.grep(GETParams, function(param, i){ return !/^resultsURL/.test(param) && !/^t/.test(param) }),
222
+ // TODO dry the selector
223
+ resultsParams: $.map(GETParams, function(param, i){
224
+ if(/^resultsURL/.test(param)){
225
+ // TODO find the proper jQuery method
226
+ return param.split("resultsURL=")[1];
227
+ } else if (/^t/.test(param)){
228
+ return param;
229
+ } else {
230
+ return null;
231
+ }
232
+ }),
233
+ isLocal: !!(window.location.protocol == 'file:')
234
+ };
235
+
236
+ // public API as global methods
237
+ $.extend(window, {
238
+ test: test,
239
+ module: module,
240
+ expect: expect,
241
+ ok: ok,
242
+ equals: equals,
243
+ start: start,
244
+ stop: stop,
245
+ reset: reset,
246
+ isLocal: config.isLocal,
247
+ same: function(a, b, message) {
248
+ push(equiv(a, b), a, b, message);
249
+ },
250
+ QUnit: {
251
+ equiv: equiv,
252
+ ok: ok,
253
+ done: function(failures, total){},
254
+ log: function(result, message){},
255
+ postResults: function(resultsParams, stats){
256
+ results = [ resultsParams[1],
257
+ "modules=" + stats.modules,
258
+ "tests=" + stats.tests,
259
+ "assertions=" + stats.all,
260
+ "failures=" + stats.bad,
261
+ "errors=" + stats.errors
262
+ ].join("&");
263
+ $.ajax({
264
+ type: "GET",
265
+ url: resultsParams[0],
266
+ data: results,
267
+ async: false
268
+ });
269
+ }
270
+ },
271
+ // legacy methods below
272
+ isSet: isSet,
273
+ isObj: isObj,
274
+ compare: function() {
275
+ throw "compare is deprecated - use same() instead";
276
+ },
277
+ compare2: function() {
278
+ throw "compare2 is deprecated - use same() instead";
279
+ },
280
+ serialArray: function() {
281
+ throw "serialArray is deprecated - use jsDump.parse() instead";
282
+ },
283
+ q: q,
284
+ t: t,
285
+ url: url,
286
+ triggerEvent: triggerEvent
287
+ });
288
+
289
+ $(window).load(function() {
290
+ $('#userAgent').html(navigator.userAgent);
291
+ var head = $('<div class="testrunner-toolbar"><label for="filter-pass">Hide passed tests</label></div>').insertAfter("#userAgent");
292
+ $('<input type="checkbox" id="filter-pass" />').attr("disabled", true).prependTo(head).click(function() {
293
+ $('li.pass')[this.checked ? 'hide' : 'show']();
294
+ });
295
+ $('<input type="checkbox" id="filter-missing">').attr("disabled", true).appendTo(head).click(function() {
296
+ $("li.fail:contains('missing test - untested code is broken code')").parent('ol').parent('li.fail')[this.checked ? 'hide' : 'show']();
297
+ });
298
+ $("#filter-missing").after('<label for="filter-missing">Hide missing tests (untested code is broken code)</label>');
299
+ runTest();
300
+ });
301
+
302
+ function synchronize(callback) {
303
+ config.queue.push(callback);
304
+ if(!config.blocking) {
305
+ process();
306
+ }
307
+ }
308
+
309
+ function process() {
310
+ while(config.queue.length && !config.blocking) {
311
+ config.queue.shift()();
312
+ }
313
+ }
314
+
315
+ function stop(timeout) {
316
+ config.blocking = true;
317
+ if (timeout)
318
+ config.timeout = setTimeout(function() {
319
+ QUnit.ok( false, "Test timed out" );
320
+ start();
321
+ }, timeout);
322
+ }
323
+ function start() {
324
+ // A slight delay, to avoid any current callbacks
325
+ setTimeout(function() {
326
+ if(config.timeout)
327
+ clearTimeout(config.timeout);
328
+ config.blocking = false;
329
+ process();
330
+ }, 13);
331
+ }
332
+
333
+ function validTest( name ) {
334
+ var i = config.filters.length,
335
+ run = false;
336
+
337
+ if( !i )
338
+ return true;
339
+
340
+ while( i-- ){
341
+ var filter = config.filters[i],
342
+ not = filter.charAt(0) == '!';
343
+ if( not )
344
+ filter = filter.slice(1);
345
+ if( name.indexOf(filter) != -1 )
346
+ return !not;
347
+ if( not )
348
+ run = true;
349
+ }
350
+ return run;
351
+ }
352
+
353
+ function runTest() {
354
+ config.blocking = false;
355
+ var started = +new Date;
356
+ config.fixture = document.getElementById('main').innerHTML;
357
+ config.ajaxSettings = $.ajaxSettings;
358
+ synchronize(function() {
359
+ $('<p id="testresult" class="result"/>').html(['Tests completed in ',
360
+ +new Date - started, ' milliseconds.<br/>',
361
+ '<span class="bad">', config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> failed.']
362
+ .join(''))
363
+ .appendTo("body");
364
+ $("#banner").addClass(config.stats.bad ? "fail" : "pass");
365
+ QUnit.postResults(config.resultsParams, config.stats);
366
+ QUnit.done( config.stats.bad, config.stats.all );
367
+ });
368
+ }
369
+
370
+ var pollution;
371
+
372
+ function saveGlobal(){
373
+ pollution = [ ];
374
+
375
+ if( noglobals )
376
+ for( var key in window )
377
+ pollution.push(key);
378
+ }
379
+ function checkPollution( name ){
380
+ var old = pollution;
381
+ saveGlobal();
382
+
383
+ if( pollution.length > old.length ){
384
+ ok( false, "Introduced global variable(s): " + diff(old, pollution).join(", ") );
385
+ config.expected++;
386
+ }
387
+ }
388
+
389
+ function diff( clean, dirty ){
390
+ return $.grep( dirty, function(name){
391
+ return $.inArray( name, clean ) == -1;
392
+ });
393
+ }
394
+
395
+ function test(name, callback) {
396
+ if(config.currentModule)
397
+ name = config.currentModule + " module: " + name;
398
+ var lifecycle = $.extend({
399
+ setup: function() {},
400
+ teardown: function() {}
401
+ }, config.moduleLifecycle);
402
+
403
+ if ( !validTest(name) )
404
+ return;
405
+
406
+ synchronize(function() {
407
+ config.assertions = [];
408
+ config.expected = null;
409
+ config.stats.tests++;
410
+ try {
411
+ if( !pollution )
412
+ saveGlobal();
413
+ lifecycle.setup();
414
+ } catch(e) {
415
+ QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
416
+ }
417
+ })
418
+ synchronize(function() {
419
+ try {
420
+ callback();
421
+ } catch(e) {
422
+ if( typeof console != "undefined" && console.error && console.warn ) {
423
+ config.stats.errors++;
424
+ console.error("Test " + name + " died, exception and test follows");
425
+ console.error(e);
426
+ console.warn(callback.toString());
427
+ }
428
+ QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
429
+ // else next test will carry the responsibility
430
+ saveGlobal();
431
+ }
432
+ });
433
+ synchronize(function() {
434
+ try {
435
+ checkPollution();
436
+ lifecycle.teardown();
437
+ } catch(e) {
438
+ QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
439
+ }
440
+ })
441
+ synchronize(function() {
442
+ try {
443
+ reset();
444
+ } catch(e) {
445
+ if( typeof console != "undefined" && console.error && console.warn ) {
446
+ console.error("reset() failed, following Test " + name + ", exception and reset fn follows");
447
+ console.error(e);
448
+ console.warn(reset.toString());
449
+ }
450
+ }
451
+
452
+ if(config.expected && config.expected != config.assertions.length) {
453
+ QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );
454
+ }
455
+
456
+ var good = 0, bad = 0;
457
+ var ol = $("<ol/>").hide();
458
+ config.stats.all += config.assertions.length;
459
+ for ( var i = 0; i < config.assertions.length; i++ ) {
460
+ var assertion = config.assertions[i];
461
+ $("<li/>").addClass(assertion.result ? "pass" : "fail").text(assertion.message || "(no message)").appendTo(ol);
462
+ assertion.result ? good++ : bad++;
463
+ }
464
+ config.stats.bad += bad;
465
+
466
+ var b = $("<strong/>").html(name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>")
467
+ .click(function(){
468
+ $(this).next().toggle();
469
+ })
470
+ .dblclick(function(event) {
471
+ var target = $(event.target).filter("strong").clone();
472
+ if ( target.length ) {
473
+ target.children().remove();
474
+ location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text()));
475
+ }
476
+ });
477
+
478
+ $("<li/>").addClass(bad ? "fail" : "pass").append(b).append(ol).appendTo("#tests");
479
+
480
+ if(bad) {
481
+ $("#filter-pass").attr("disabled", null);
482
+ $("#filter-missing").attr("disabled", null);
483
+ }
484
+ });
485
+ }
486
+
487
+ // call on start of module test to prepend name to all tests
488
+ function module(name, lifecycle) {
489
+ config.currentModule = name;
490
+ config.moduleLifecycle = lifecycle;
491
+ config.stats.modules++;
492
+ }
493
+
494
+ /**
495
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
496
+ */
497
+ function expect(asserts) {
498
+ config.expected = asserts;
499
+ }
500
+
501
+ /**
502
+ * Resets the test setup. Useful for tests that modify the DOM.
503
+ */
504
+ function reset() {
505
+ $("#main").html( config.fixture );
506
+ $.event.global = {};
507
+ $.ajaxSettings = $.extend({}, config.ajaxSettings);
508
+ }
509
+
510
+ /**
511
+ * Asserts true.
512
+ * @example ok( $("a").size() > 5, "There must be at least 5 anchors" );
513
+ */
514
+ function ok(a, msg) {
515
+ QUnit.log(a, msg);
516
+
517
+ config.assertions.push({
518
+ result: !!a,
519
+ message: msg
520
+ });
521
+ }
522
+
523
+ /**
524
+ * Asserts that two arrays are the same
525
+ */
526
+ function isSet(a, b, msg) {
527
+ function serialArray( a ) {
528
+ var r = [];
529
+
530
+ if ( a && a.length )
531
+ for ( var i = 0; i < a.length; i++ ) {
532
+ var str = a[i].nodeName;
533
+ if ( str ) {
534
+ str = str.toLowerCase();
535
+ if ( a[i].id )
536
+ str += "#" + a[i].id;
537
+ } else
538
+ str = a[i];
539
+ r.push( str );
540
+ }
541
+
542
+ return "[ " + r.join(", ") + " ]";
543
+ }
544
+ var ret = true;
545
+ if ( a && b && a.length != undefined && a.length == b.length ) {
546
+ for ( var i = 0; i < a.length; i++ )
547
+ if ( a[i] != b[i] )
548
+ ret = false;
549
+ } else
550
+ ret = false;
551
+ QUnit.ok( ret, !ret ? (msg + " expected: " + serialArray(b) + " result: " + serialArray(a)) : msg );
552
+ }
553
+
554
+ /**
555
+ * Asserts that two objects are equivalent
556
+ */
557
+ function isObj(a, b, msg) {
558
+ var ret = true;
559
+
560
+ if ( a && b ) {
561
+ for ( var i in a )
562
+ if ( a[i] != b[i] )
563
+ ret = false;
564
+
565
+ for ( i in b )
566
+ if ( a[i] != b[i] )
567
+ ret = false;
568
+ } else
569
+ ret = false;
570
+
571
+ QUnit.ok( ret, msg );
572
+ }
573
+
574
+ /**
575
+ * Returns an array of elements with the given IDs, eg.
576
+ * @example q("main", "foo", "bar")
577
+ * @result [<div id="main">, <span id="foo">, <input id="bar">]
578
+ */
579
+ function q() {
580
+ var r = [];
581
+ for ( var i = 0; i < arguments.length; i++ )
582
+ r.push( document.getElementById( arguments[i] ) );
583
+ return r;
584
+ }
585
+
586
+ /**
587
+ * Asserts that a select matches the given IDs
588
+ * @example t("Check for something", "//[a]", ["foo", "baar"]);
589
+ * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
590
+ */
591
+ function t(a,b,c) {
592
+ var f = $(b);
593
+ var s = "";
594
+ for ( var i = 0; i < f.length; i++ )
595
+ s += (s && ",") + '"' + f[i].id + '"';
596
+ isSet(f, q.apply(q,c), a + " (" + b + ")");
597
+ }
598
+
599
+ /**
600
+ * Add random number to url to stop IE from caching
601
+ *
602
+ * @example url("data/test.html")
603
+ * @result "data/test.html?10538358428943"
604
+ *
605
+ * @example url("data/test.php?foo=bar")
606
+ * @result "data/test.php?foo=bar&10538358345554"
607
+ */
608
+ function url(value) {
609
+ return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
610
+ }
611
+
612
+ /**
613
+ * Checks that the first two arguments are equal, with an optional message.
614
+ * Prints out both actual and expected values.
615
+ *
616
+ * Prefered to ok( actual == expected, message )
617
+ *
618
+ * @example equals( $.format("Received {0} bytes.", 2), "Received 2 bytes." );
619
+ *
620
+ * @param Object actual
621
+ * @param Object expected
622
+ * @param String message (optional)
623
+ */
624
+ function equals(actual, expected, message) {
625
+ push(expected == actual, actual, expected, message);
626
+ }
627
+
628
+ function push(result, actual, expected, message) {
629
+ message = message || (result ? "okay" : "failed");
630
+ QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + jsDump.parse(expected) + " result: " + jsDump.parse(actual) );
631
+ }
632
+
633
+ /**
634
+ * Trigger an event on an element.
635
+ *
636
+ * @example triggerEvent( document.body, "click" );
637
+ *
638
+ * @param DOMElement elem
639
+ * @param String type
640
+ */
641
+ function triggerEvent( elem, type, event ) {
642
+ if ( $.browser.mozilla || $.browser.opera ) {
643
+ event = document.createEvent("MouseEvents");
644
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
645
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
646
+ elem.dispatchEvent( event );
647
+ } else if ( $.browser.msie ) {
648
+ elem.fireEvent("on"+type);
649
+ }
650
+ }
651
+
652
+ })(jQuery);
653
+
654
+ /**
655
+ * jsDump
656
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
657
+ * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
658
+ * Date: 5/15/2008
659
+ * @projectDescription Advanced and extensible data dumping for Javascript.
660
+ * @version 1.0.0
661
+ * @author Ariel Flesler
662
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
663
+ */
664
+ (function(){
665
+ function quote( str ){
666
+ return '"' + str.toString().replace(/"/g, '\\"') + '"';
667
+ };
668
+ function literal( o ){
669
+ return o + '';
670
+ };
671
+ function join( pre, arr, post ){
672
+ var s = jsDump.separator(),
673
+ base = jsDump.indent();
674
+ inner = jsDump.indent(1);
675
+ if( arr.join )
676
+ arr = arr.join( ',' + s + inner );
677
+ if( !arr )
678
+ return pre + post;
679
+ return [ pre, inner + arr, base + post ].join(s);
680
+ };
681
+ function array( arr ){
682
+ var i = arr.length, ret = Array(i);
683
+ this.up();
684
+ while( i-- )
685
+ ret[i] = this.parse( arr[i] );
686
+ this.down();
687
+ return join( '[', ret, ']' );
688
+ };
689
+
690
+ var reName = /^function (\w+)/;
691
+
692
+ var jsDump = window.jsDump = {
693
+ parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance
694
+ var parser = this.parsers[ type || this.typeOf(obj) ];
695
+ type = typeof parser;
696
+
697
+ return type == 'function' ? parser.call( this, obj ) :
698
+ type == 'string' ? parser :
699
+ this.parsers.error;
700
+ },
701
+ typeOf:function( obj ){
702
+ var type = typeof obj,
703
+ f = 'function';//we'll use it 3 times, save it
704
+ return type != 'object' && type != f ? type :
705
+ !obj ? 'null' :
706
+ obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions
707
+ obj.getHours ? 'date' :
708
+ obj.scrollBy ? 'window' :
709
+ obj.nodeName == '#document' ? 'document' :
710
+ obj.nodeName ? 'node' :
711
+ obj.item ? 'nodelist' : // Safari reports nodelists as functions
712
+ obj.callee ? 'arguments' :
713
+ obj.call || obj.constructor != Array && //an array would also fall on this hack
714
+ (obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects
715
+ 'length' in obj ? 'array' :
716
+ type;
717
+ },
718
+ separator:function(){
719
+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
720
+ },
721
+ indent:function( extra ){// extra can be a number, shortcut for increasing-calling-decreasing
722
+ if( !this.multiline )
723
+ return '';
724
+ var chr = this.indentChar;
725
+ if( this.HTML )
726
+ chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
727
+ return Array( this._depth_ + (extra||0) ).join(chr);
728
+ },
729
+ up:function( a ){
730
+ this._depth_ += a || 1;
731
+ },
732
+ down:function( a ){
733
+ this._depth_ -= a || 1;
734
+ },
735
+ setParser:function( name, parser ){
736
+ this.parsers[name] = parser;
737
+ },
738
+ // The next 3 are exposed so you can use them
739
+ quote:quote,
740
+ literal:literal,
741
+ join:join,
742
+ //
743
+ _depth_: 1,
744
+ // This is the list of parsers, to modify them, use jsDump.setParser
745
+ parsers:{
746
+ window: '[Window]',
747
+ document: '[Document]',
748
+ error:'[ERROR]', //when no parser is found, shouldn't happen
749
+ unknown: '[Unknown]',
750
+ 'null':'null',
751
+ undefined:'undefined',
752
+ 'function':function( fn ){
753
+ var ret = 'function',
754
+ name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
755
+ if( name )
756
+ ret += ' ' + name;
757
+ ret += '(';
758
+
759
+ ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
760
+ return join( ret, this.parse(fn,'functionCode'), '}' );
761
+ },
762
+ array: array,
763
+ nodelist: array,
764
+ arguments: array,
765
+ object:function( map ){
766
+ var ret = [ ];
767
+ this.up();
768
+ for( var key in map )
769
+ ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
770
+ this.down();
771
+ return join( '{', ret, '}' );
772
+ },
773
+ node:function( node ){
774
+ var open = this.HTML ? '&lt;' : '<',
775
+ close = this.HTML ? '&gt;' : '>';
776
+
777
+ var tag = node.nodeName.toLowerCase(),
778
+ ret = open + tag;
779
+
780
+ for( var a in this.DOMAttrs ){
781
+ var val = node[this.DOMAttrs[a]];
782
+ if( val )
783
+ ret += ' ' + a + '=' + this.parse( val, 'attribute' );
784
+ }
785
+ return ret + close + open + '/' + tag + close;
786
+ },
787
+ functionArgs:function( fn ){//function calls it internally, it's the arguments part of the function
788
+ var l = fn.length;
789
+ if( !l ) return '';
790
+
791
+ var args = Array(l);
792
+ while( l-- )
793
+ args[l] = String.fromCharCode(97+l);//97 is 'a'
794
+ return ' ' + args.join(', ') + ' ';
795
+ },
796
+ key:quote, //object calls it internally, the key part of an item in a map
797
+ functionCode:'[code]', //function calls it internally, it's the content of the function
798
+ attribute:quote, //node calls it internally, it's an html attribute value
799
+ string:quote,
800
+ date:quote,
801
+ regexp:literal, //regex
802
+ number:literal,
803
+ 'boolean':literal
804
+ },
805
+ DOMAttrs:{//attributes to dump from nodes, name=>realName
806
+ id:'id',
807
+ name:'name',
808
+ 'class':'className'
809
+ },
810
+ HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
811
+ indentChar:' ',//indentation unit
812
+ multiline:true //if true, items in a collection, are separated by a \n, else just a space.
813
+ };
814
+
815
+ })();