kiteditor 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. data/POST_INSTALL +21 -0
  2. data/{vendor → app}/assets/images/mercury/button.png +0 -0
  3. data/{vendor → app}/assets/images/mercury/close.png +0 -0
  4. data/app/assets/images/mercury/default-snippet.png +0 -0
  5. data/{vendor → app}/assets/images/mercury/loading-dark.gif +0 -0
  6. data/{vendor → app}/assets/images/mercury/loading-light.gif +0 -0
  7. data/{vendor → app}/assets/images/mercury/missing-image.png +0 -0
  8. data/{vendor → app}/assets/images/mercury/search-icon.png +0 -0
  9. data/{vendor → app}/assets/images/mercury/temp-logo.png +0 -0
  10. data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  11. data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  12. data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  13. data/app/assets/images/mercury/toolbar/primary/action.png +0 -0
  14. data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  15. data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  16. data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  17. data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  18. data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  19. data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  20. data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  21. data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
  22. data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
  23. data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
  24. data/app/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
  25. data/app/assets/images/mercury/toolbar/primary/tools.png +0 -0
  26. data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
  27. data/app/assets/images/mercury/toolbar/primary/user.png +0 -0
  28. data/app/assets/images/mercury/toolbar/snippets/buttons.png +0 -0
  29. data/{vendor/assets/javascripts/mercury/dependencies → app/assets/javascripts}/jquery-1.7.js +0 -0
  30. data/{vendor → app}/assets/javascripts/mercury.js +60 -87
  31. data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
  32. data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.additions.js +103 -13
  33. data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
  34. data/{vendor → app}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
  35. data/{vendor → app}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
  36. data/{vendor → app}/assets/javascripts/mercury/dialog.js.coffee +0 -0
  37. data/{vendor → app}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
  38. data/{vendor → app}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
  39. data/{vendor → app}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
  40. data/{vendor → app}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
  41. data/{vendor → app}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
  42. data/{vendor → app}/assets/javascripts/mercury/finalize.js.coffee +0 -0
  43. data/{vendor → app}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
  44. data/{vendor → app}/assets/javascripts/mercury/lightview.js.coffee +38 -17
  45. data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +201 -0
  46. data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +208 -0
  47. data/{vendor → app}/assets/javascripts/mercury/locales/de.locale.js.coffee +4 -10
  48. data/{vendor → app}/assets/javascripts/mercury/locales/es.locale.js.coffee +3 -9
  49. data/{vendor → app}/assets/javascripts/mercury/locales/example.local.js.coffee +3 -5
  50. data/{vendor → app}/assets/javascripts/mercury/locales/fr.locale.js.coffee +3 -9
  51. data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +209 -0
  52. data/{vendor → app}/assets/javascripts/mercury/locales/it.locale.js.coffee +3 -9
  53. data/{vendor → app}/assets/javascripts/mercury/locales/ko.local.js.coffee +4 -10
  54. data/{vendor → app}/assets/javascripts/mercury/locales/nl.locale.js.coffee +3 -9
  55. data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +213 -0
  56. data/{vendor → app}/assets/javascripts/mercury/locales/pt.locale.js.coffee +3 -9
  57. data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +200 -0
  58. data/{vendor → app}/assets/javascripts/mercury/locales/sv.local.js.coffee +3 -9
  59. data/{vendor → app}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +3 -9
  60. data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +200 -0
  61. data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +203 -0
  62. data/app/assets/javascripts/mercury/mercury-compiled.js +10720 -0
  63. data/{vendor → app}/assets/javascripts/mercury/mercury.js.coffee +10 -1
  64. data/{vendor → app}/assets/javascripts/mercury/modal.js.coffee +62 -40
  65. data/{vendor → app}/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -0
  66. data/{vendor → app}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +1 -0
  67. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +152 -0
  68. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +132 -0
  69. data/{vendor → app}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -0
  70. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +68 -0
  71. data/{vendor → app}/assets/javascripts/mercury/native_extensions.js.coffee +0 -6
  72. data/{vendor → app}/assets/javascripts/mercury/page_editor.js.coffee +84 -50
  73. data/{vendor → app}/assets/javascripts/mercury/palette.js.coffee +1 -1
  74. data/{vendor → app}/assets/javascripts/mercury/panel.js.coffee +3 -2
  75. data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
  76. data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
  77. data/{vendor → app}/assets/javascripts/mercury/region.js.coffee +18 -17
  78. data/{vendor/assets/javascripts/mercury/regions/editable.js.coffee → app/assets/javascripts/mercury/regions/full.js.coffee} +41 -31
  79. data/app/assets/javascripts/mercury/regions/image.js.coffee +93 -0
  80. data/{vendor/assets/javascripts/mercury/regions/markupable.js.coffee → app/assets/javascripts/mercury/regions/markdown.js.coffee} +29 -24
  81. data/{vendor → app}/assets/javascripts/mercury/regions/simple.js.coffee +11 -54
  82. data/{vendor/assets/javascripts/mercury/regions/snippetable.js.coffee → app/assets/javascripts/mercury/regions/snippets.js.coffee} +10 -9
  83. data/{vendor → app}/assets/javascripts/mercury/select.js.coffee +1 -1
  84. data/app/assets/javascripts/mercury/snippet.js.coffee +136 -0
  85. data/{vendor → app}/assets/javascripts/mercury/snippet_toolbar.js.coffee +19 -6
  86. data/{vendor → app}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
  87. data/{vendor → app}/assets/javascripts/mercury/support/history.js +0 -0
  88. data/{vendor → app}/assets/javascripts/mercury/table_editor.js.coffee +16 -0
  89. data/{vendor → app}/assets/javascripts/mercury/toolbar.button.js.coffee +45 -30
  90. data/{vendor → app}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
  91. data/{vendor → app}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
  92. data/{vendor → app}/assets/javascripts/mercury/toolbar.js.coffee +10 -6
  93. data/{vendor → app}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
  94. data/{vendor → app}/assets/javascripts/mercury/uploader.js.coffee +37 -19
  95. data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +61 -0
  96. data/app/assets/stylesheets/_mercury-sass.scss +33 -0
  97. data/{vendor → app}/assets/stylesheets/mercury.css +1 -5
  98. data/{vendor → app}/assets/stylesheets/mercury/all_images.css.erb +6 -2
  99. data/app/assets/stylesheets/mercury/bootstrap-ish.css +1367 -0
  100. data/app/assets/stylesheets/mercury/bootstrap-overrides.css +61 -0
  101. data/{vendor → app}/assets/stylesheets/mercury/dialog.css +21 -8
  102. data/{vendor → app}/assets/stylesheets/mercury/lightview.css +6 -56
  103. data/app/assets/stylesheets/mercury/mercury.css +43 -0
  104. data/{vendor → app}/assets/stylesheets/mercury/modal.css +15 -32
  105. data/{vendor → app}/assets/stylesheets/mercury/statusbar.css +0 -0
  106. data/{vendor → app}/assets/stylesheets/mercury/toolbar.css +4 -1
  107. data/{vendor → app}/assets/stylesheets/mercury/tooltip.css +0 -0
  108. data/{vendor → app}/assets/stylesheets/mercury/uploader.css +4 -4
  109. data/app/helpers/mercury_helper.rb +7 -0
  110. data/app/views/layouts/mercury.html.erb +10 -20
  111. data/app/views/layouts/mercury.html.haml +19 -0
  112. data/app/views/layouts/mercury.html.slim +19 -0
  113. data/app/views/mercury/modals/character.html +1 -1
  114. data/app/views/mercury/modals/htmleditor.html +3 -7
  115. data/app/views/mercury/modals/link.html +37 -51
  116. data/app/views/mercury/modals/media.html +102 -0
  117. data/app/views/mercury/modals/table.html +79 -73
  118. data/app/views/mercury/panels/snippets.html +6 -1
  119. data/app/views/mercury/snippets/example/options.html.erb +23 -27
  120. data/app/views/mercury/snippets/no_options/preview.html.erb +1 -0
  121. data/config/routes.rb +9 -0
  122. data/features/generators/authentication.feature +10 -0
  123. data/features/generators/images.feature +41 -0
  124. data/features/generators/install.feature +21 -0
  125. data/features/loading/loading.feature +5 -2
  126. data/features/loading/user_interface.feature +9 -7
  127. data/features/regions/{editable → full}/advanced_editing.feature +0 -0
  128. data/features/regions/full/basic_editing.feature +198 -0
  129. data/features/regions/{editable → full}/inserting_links.feature +20 -19
  130. data/features/regions/{editable → full}/inserting_media.feature +36 -18
  131. data/features/regions/{editable → full}/inserting_snippets.feature +28 -18
  132. data/features/regions/{editable → full}/inserting_special_characters.feature +2 -2
  133. data/features/regions/full/inserting_tables.feature +109 -0
  134. data/features/regions/{editable → full}/pasting.feature +0 -0
  135. data/features/regions/{editable → full}/uploading_images.feature +0 -0
  136. data/features/regions/{markupable → image}/uploading_images.feature +0 -0
  137. data/features/regions/{markupable → markdown}/advanced_editing.feature +0 -0
  138. data/features/regions/{markupable → markdown}/basic_editing.feature +0 -0
  139. data/features/regions/{markupable → markdown}/inserting_links.feature +0 -0
  140. data/features/regions/{markupable → markdown}/inserting_media.feature +0 -0
  141. data/features/regions/{markupable → markdown}/inserting_snippets.feature +0 -0
  142. data/features/regions/{markupable → markdown}/inserting_special_characters.feature +0 -0
  143. data/features/regions/{markupable → markdown}/inserting_tables.feature +0 -0
  144. data/features/regions/{snippetable/advanced_editing.feature → markdown/uploading_images.feature} +0 -0
  145. data/features/regions/simple/basic_editing.feature +5 -0
  146. data/features/regions/{snippetable/basic_editing.feature → snippets/advanced_editing.feature} +0 -0
  147. data/features/regions/{snippetable/inserting_snippets.feature → snippets/basic_editing.feature} +0 -0
  148. data/{vendor/assets/javascripts/mercury/locales/da.locale.js.coffee → features/regions/snippets/inserting_snippets.feature} +0 -0
  149. data/features/saving/saving.feature +8 -8
  150. data/features/step_definitions/custom_web_steps.rb +22 -0
  151. data/features/step_definitions/generator_steps.rb +23 -0
  152. data/features/step_definitions/mercury_steps.rb +1 -438
  153. data/features/support/aruba.rb +28 -0
  154. data/features/support/env.rb +11 -1
  155. data/features/support/selectors.rb +23 -0
  156. data/lib/generators/mercury/install/authentication/authentication_generator.rb +17 -0
  157. data/lib/generators/mercury/install/images/images_generator.rb +47 -0
  158. data/{app/models/mercury/image.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image.rb} +7 -0
  159. data/{db/migrate/20110526035601_create_mercury_images.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb} +0 -0
  160. data/{app/controllers/mercury → lib/generators/mercury/install/images/templates}/images_controller.rb +0 -0
  161. data/lib/generators/mercury/install/{templates → images/templates}/mongoid_paperclip_image.rb +0 -0
  162. data/lib/generators/mercury/install/install_generator.rb +12 -23
  163. data/lib/mercury-rails.rb +1 -2
  164. data/lib/mercury/authentication.rb +1 -0
  165. data/lib/mercury/cucumber/step_definitions.rb +13 -0
  166. data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +408 -0
  167. data/{features → lib/mercury/cucumber}/support/mercury_contents.rb +3 -3
  168. data/{features → lib/mercury/cucumber}/support/mercury_selectors.rb +0 -20
  169. data/lib/mercury/engine.rb +19 -0
  170. data/lib/mercury/rails.rb +5 -0
  171. data/lib/mercury/version.rb +3 -0
  172. data/spec/dummy/Rakefile +7 -0
  173. data/spec/dummy/app/assets/javascripts/application.js +0 -0
  174. data/spec/dummy/app/assets/javascripts/prototype.js +6082 -0
  175. data/spec/dummy/app/assets/stylesheets/application.css.scss +110 -0
  176. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  177. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  178. data/spec/dummy/app/views/layouts/mercury.html.erb +28 -0
  179. data/spec/dummy/config.ru +4 -0
  180. data/spec/dummy/config/application.rb +58 -0
  181. data/spec/dummy/config/boot.rb +10 -0
  182. data/spec/dummy/config/database.yml +10 -0
  183. data/spec/dummy/config/environment.rb +5 -0
  184. data/spec/dummy/config/environments/development.rb +37 -0
  185. data/spec/dummy/config/environments/production.rb +67 -0
  186. data/spec/dummy/config/environments/test.rb +37 -0
  187. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  188. data/spec/dummy/config/initializers/inflections.rb +15 -0
  189. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  190. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  191. data/spec/dummy/config/initializers/session_store.rb +8 -0
  192. data/spec/dummy/config/initializers/teabag.rb +9 -0
  193. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  194. data/spec/dummy/config/locales/en.yml +5 -0
  195. data/spec/dummy/config/routes.rb +5 -0
  196. data/spec/dummy/db/.gitkeep +0 -0
  197. data/spec/dummy/public/500.html +25 -0
  198. data/spec/dummy/public/blank.html +1 -0
  199. data/spec/dummy/public/favicon.ico +0 -0
  200. data/spec/dummy/public/images/bunny.gif +0 -0
  201. data/spec/dummy/public/images/bunny2.jpg +0 -0
  202. data/spec/dummy/public/index.html +279 -0
  203. data/spec/dummy/script/rails +6 -0
  204. data/spec/javascripts/{templates → fixtures}/mercury/dialog.html +0 -0
  205. data/spec/javascripts/{templates → fixtures}/mercury/dialogs/backcolor.html +0 -0
  206. data/spec/javascripts/{templates → fixtures}/mercury/dialogs/forecolor.html +0 -0
  207. data/spec/javascripts/{templates → fixtures}/mercury/dialogs/formatblock.html +0 -0
  208. data/spec/javascripts/{templates → fixtures}/mercury/dialogs/snippetpanel.html +0 -0
  209. data/spec/javascripts/{templates → fixtures}/mercury/dialogs/style.html +0 -0
  210. data/spec/javascripts/{templates → fixtures}/mercury/lightview.html +0 -0
  211. data/spec/javascripts/{templates → fixtures}/mercury/modal.html +0 -0
  212. data/spec/javascripts/{templates → fixtures}/mercury/modals/htmleditor.html +0 -0
  213. data/spec/javascripts/{templates → fixtures}/mercury/modals/insertcharacter.html +0 -0
  214. data/spec/javascripts/fixtures/mercury/modals/insertlink.html +67 -0
  215. data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +87 -0
  216. data/spec/javascripts/{templates → fixtures}/mercury/modals/insertsnippet.html +0 -0
  217. data/spec/javascripts/fixtures/mercury/modals/inserttable.html +73 -0
  218. data/spec/javascripts/{templates → fixtures}/mercury/page_editor.html +4 -4
  219. data/spec/javascripts/{templates → fixtures}/mercury/palette.html +0 -0
  220. data/spec/javascripts/{templates → fixtures}/mercury/panel.html +0 -0
  221. data/spec/javascripts/fixtures/mercury/region.html +6 -0
  222. data/spec/javascripts/fixtures/mercury/regions/full.html +1 -0
  223. data/spec/javascripts/fixtures/mercury/regions/image.html +1 -0
  224. data/spec/javascripts/fixtures/mercury/regions/markdown.html +1 -0
  225. data/spec/javascripts/fixtures/mercury/regions/simple.html +1 -0
  226. data/spec/javascripts/fixtures/mercury/regions/snippets.html +4 -0
  227. data/spec/javascripts/{templates → fixtures}/mercury/select.html +0 -0
  228. data/spec/javascripts/{templates → fixtures}/mercury/snippet.html +0 -0
  229. data/spec/javascripts/{templates → fixtures}/mercury/snippet_toolbar.html +0 -0
  230. data/spec/javascripts/{templates → fixtures}/mercury/statusbar.html +0 -0
  231. data/spec/javascripts/{templates → fixtures}/mercury/table_editor.html +0 -0
  232. data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button.html +0 -0
  233. data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button_group.html +0 -0
  234. data/spec/javascripts/{templates → fixtures}/mercury/toolbar.expander.html +0 -0
  235. data/spec/javascripts/{templates → fixtures}/mercury/toolbar.html +0 -0
  236. data/spec/javascripts/{templates → fixtures}/mercury/tooltip.html +0 -0
  237. data/spec/javascripts/{templates → fixtures}/mercury/uploader.html +0 -0
  238. data/spec/javascripts/mercury/{dialog_spec.js.coffee → dialog_spec.coffee} +11 -12
  239. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +2 -3
  240. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -4
  241. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +2 -3
  242. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +2 -3
  243. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +2 -3
  244. data/spec/javascripts/mercury/lightview_spec.js.coffee +180 -142
  245. data/spec/javascripts/mercury/mercury_spec.js.coffee +19 -13
  246. data/spec/javascripts/mercury/modal_spec.js.coffee +192 -148
  247. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -5
  248. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
  249. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +107 -34
  250. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +106 -26
  251. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +2 -3
  252. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +50 -40
  253. data/spec/javascripts/mercury/page_editor_spec.js.coffee +124 -80
  254. data/spec/javascripts/mercury/palette_spec.js.coffee +4 -5
  255. data/spec/javascripts/mercury/panel_spec.js.coffee +9 -12
  256. data/spec/javascripts/mercury/region_spec.js.coffee +22 -17
  257. data/spec/javascripts/mercury/regions/{editable_spec.js.coffee → full_spec.js.coffee} +26 -28
  258. data/spec/javascripts/mercury/regions/image_spec.js.coffee +33 -0
  259. data/spec/javascripts/mercury/regions/{markupable_spec.js.coffee → markdown_spec.js.coffee} +32 -34
  260. data/spec/javascripts/mercury/regions/simple_spec.js.coffee +32 -0
  261. data/spec/javascripts/mercury/regions/{snippetable_spec.js.coffee → snippets_spec.js.coffee} +54 -55
  262. data/spec/javascripts/mercury/select_spec.js.coffee +4 -5
  263. data/spec/javascripts/mercury/snippet_spec.js.coffee +92 -16
  264. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +31 -16
  265. data/spec/javascripts/mercury/statusbar_spec.js.coffee +9 -10
  266. data/spec/javascripts/mercury/table_editor_spec.js.coffee +1 -2
  267. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +7 -9
  268. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +55 -26
  269. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
  270. data/spec/javascripts/mercury/toolbar_spec.js.coffee +43 -14
  271. data/spec/javascripts/mercury/tooltip_spec.js.coffee +1 -2
  272. data/spec/javascripts/mercury/uploader_spec.js.coffee +47 -33
  273. data/spec/javascripts/spec_helper.coffee +4 -0
  274. data/spec/javascripts/{spec_helper.js → support/event_simulation.js} +0 -2
  275. data/spec/teabag_env.rb +32 -0
  276. metadata +366 -196
  277. data/features/regions/editable/basic_editing.feature +0 -195
  278. data/features/regions/editable/inserting_tables.feature +0 -109
  279. data/spec/javascripts/templates/mercury/modals/insertlink.html +0 -30
  280. data/spec/javascripts/templates/mercury/modals/insertmedia.html +0 -35
  281. data/spec/javascripts/templates/mercury/modals/inserttable.html +0 -27
  282. data/spec/javascripts/templates/mercury/region.html +0 -2
  283. data/spec/javascripts/templates/mercury/regions/editable.html +0 -3
  284. data/spec/javascripts/templates/mercury/regions/snippetable.html +0 -4
  285. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -54
  286. data/vendor/assets/javascripts/mercury_loader.js +0 -193
  287. data/vendor/assets/javascripts/mercury_overrides.js +0 -6
  288. data/vendor/assets/stylesheets/mercury/mercury.css +0 -151
  289. data/vendor/assets/stylesheets/mercury_overrides.css +0 -17
@@ -0,0 +1,87 @@
1
+ <form>
2
+
3
+ <div class="control-group url optional">
4
+ <label class="url optional control-label" for="media_image_url">
5
+ <input name="media_type" type="radio" value="image_url" checked="checked"/>URL
6
+ </label>
7
+ <div class="controls">
8
+ <input class="string url optional" id="media_image_url" name="media[image_url]" size="50" type="text">
9
+ </div>
10
+ </div>
11
+
12
+ <div class="control-group url optional">
13
+ <label class="url optional control-label" for="media_youtube_url">
14
+ <input name="media_type" type="radio" value="youtube_url"/>Youtube Share URL
15
+ </label>
16
+ <div class="controls">
17
+ <input class="string url optional" id="media_youtube_url" name="media[youtube_url]" size="50" type="text" placeholder="http://youtu.be/Pny4hoN8eII">
18
+ </div>
19
+ </div>
20
+ <div class="control-group url optional">
21
+ <label class="url optional control-label" for="media_vimeo_url">
22
+ <input name="media_type" type="radio" value="vimeo_url"/>Vimeo URL
23
+ </label>
24
+ <div class="controls">
25
+ <input class="string url optional" id="media_vimeo_url" name="media[vimeo_url]" size="50" type="text" placeholder="http://vimeo.com/25708134">
26
+ </div>
27
+ </div>
28
+
29
+ <div class="media-options" id="image_url_options">
30
+ <div class="control-group select optional">
31
+ <label class="select optional control-label" for="media_image_alignment">Alignment</label>
32
+ <div class="controls">
33
+ <select class="select optional" id="media_image_alignment" name="media[image_alignment]">
34
+ <option value="">None</option>
35
+ <option value="left">Left</option>
36
+ <option value="right">Right</option>
37
+ <option value="top">Top</option>
38
+ <option value="middle">Middle</option>
39
+ <option value="bottom">Bottom</option>
40
+ <option value="absmiddle">Absolute Middle</option>
41
+ <option value="absbottom">Absolute Bottom</option>
42
+ </select>
43
+ </div>
44
+ <label class="select optional control-label" for="media_image_float">Float</label>
45
+ <div class="controls">
46
+ <select class="select optional" id="media_image_float" name="media[image_float]">
47
+ <option value="">None</option>
48
+ <option value="left">Left</option>
49
+ <option value="right">Right</option>
50
+ <option value="none">None</option>
51
+ <option value="inherit">Inherit</option>
52
+ </select>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <div class="media-options" id="youtube_url_options" style="display:none">
57
+ <div class="control-group number optional">
58
+ <label class="number optional control-label" for="media_youtube_width">Width</label>
59
+ <div class="controls">
60
+ <input class="number optional" id="media_youtube_width" name="media[youtube_width]" size="50" type="number" value="560">
61
+ </div>
62
+ </div>
63
+ <div class="control-group number optional">
64
+ <label class="number optional control-label" for="media_youtube_height">Height</label>
65
+ <div class="controls">
66
+ <input class="number optional" id="media_youtube_height" name="media[youtube_height]" size="50" type="number" value="349">
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div class="media-options" id="vimeo_url_options" style="display:none">
71
+ <div class="control-group number optional">
72
+ <label class="number optional control-label" for="media_vimeo_width">Width</label>
73
+ <div class="controls">
74
+ <input class="number optional" id="media_vimeo_width" name="media[vimeo_width]" size="50" type="number" value="400">
75
+ </div>
76
+ </div>
77
+ <div class="control-group number optional">
78
+ <label class="number optional control-label" for="media_vimeo_height">Height</label>
79
+ <div class="controls">
80
+ <input class="number optional" id="media_vimeo_height" name="media[vimeo_height]" size="50" type="number" value="225">
81
+ </div>
82
+ </div>
83
+ </div>
84
+
85
+ <input class="submit" name="commit" type="submit" value="Insert Media"/>
86
+
87
+ </form>
@@ -0,0 +1,73 @@
1
+ <form>
2
+
3
+ <div id="table_display" class="control-group optional">
4
+ <div class="controls">
5
+ <table border="1" cellspacing="0">
6
+ <tr>
7
+ <td id="cell1">&nbsp;</td>
8
+ </tr>
9
+ <tr>
10
+ <td id="cell2">&nbsp;</td>
11
+ </tr>
12
+ </table>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="control-group buttons optional">
17
+ <label class="buttons optional control-label">Rows</label>
18
+ <div class="controls btn-group">
19
+ <button class="btn" data-action="addRowBefore">Add Before</button>
20
+ <button class="btn" data-action="addRow">Add After</button>
21
+ <button class="btn" data-action="removeRow">Remove</button>
22
+ </div>
23
+ </div>
24
+ <div class="control-group buttons optional">
25
+ <label class="buttons optional control-label">Columns</label>
26
+ <div class="controls btn-group">
27
+ <button class="btn" data-action="addColumnBefore">Add Before</button>
28
+ <button class="btn" data-action="addColumn">Add After</button>
29
+ <button class="btn" data-action="removeColumn">Remove</button>
30
+ </div>
31
+ </div>
32
+ <hr/>
33
+ <div class="control-group buttons optional">
34
+ <label class="buttons optional control-label">Row Span</label>
35
+ <div class="controls btn-group">
36
+ <button class="btn" data-action="increaseRowspan">+</button>
37
+ <button class="btn" data-action="decreaseRowspan">-</button>
38
+ </div>
39
+ </div>
40
+ <div class="control-group buttons optional">
41
+ <label class="buttons optional control-label">Column Span</label>
42
+ <div class="controls btn-group">
43
+ <button class="btn" data-action="increaseColspan">+</button>
44
+ <button class="btn" data-action="decreaseColspan">-</button>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="control-group select optional">
49
+ <label class="select optional control-label" for="table_alignment">Alignment</label>
50
+ <div class="controls">
51
+ <select class="select optional" id="table_alignment" name="table[alignment]">
52
+ <option value="">None</option>
53
+ <option value="right">Right</option>
54
+ <option value="left">Left</option>
55
+ </select>
56
+ </div>
57
+ </div>
58
+ <div class="control-group number optional">
59
+ <label class="number optional control-label" for="table_border">Border</label>
60
+ <div class="controls">
61
+ <input class="number optional" id="table_border" name="table[border]" size="50" type="number" value="1">
62
+ </div>
63
+ </div>
64
+ <div class="control-group number optional">
65
+ <label class="number optional control-label" for="table_spacing">Spacing</label>
66
+ <div class="controls">
67
+ <input class="number optional" id="table_spacing" name="table[spacing]" size="50" type="number" value="0">
68
+ </div>
69
+ </div>
70
+
71
+ <input class="submit" name="commit" type="submit" value="Insert Table"/>
72
+
73
+ </form>
@@ -7,9 +7,9 @@
7
7
  <meta content="K6JhyfOVKJX8X2ZkiJXSf491fc1fF+k79wzrChHQa0g=" name="csrf-token" />
8
8
 
9
9
  <div id="page_editor_container"></div>
10
- <div id="region1" class="custom-region-class" data-type="editable"></div>
11
- <div id="region2" class="custom-region-class" data-type="editable"></div>
12
- <div id="region3" class="custom-region-class" data-type="editable">
10
+ <div id="region1" custom-region-attribute="full"></div>
11
+ <div id="region2" custom-region-attribute="full"></div>
12
+ <div id="region3" custom-region-attribute="full">
13
13
  <a id="anchor1r" href="#" target="_top">1</a>
14
14
  <a id="anchor2r" href="#" target="_blank">2</a>
15
15
  <a id="anchor3r" href="#" target="_self">3</a>
@@ -19,7 +19,7 @@
19
19
  <form id="form3r" action="" target="_self"></form>
20
20
  <form id="form4r" action=""></form>
21
21
  </div>
22
- <div id="region4" class="custom-region-class"></div>
22
+ <div id="region4" custom-region-attribute=""></div>
23
23
 
24
24
  <a id="anchor1" href="#" target="_top">1</a>
25
25
  <a id="anchor2" href="#" target="_blank">2</a>
@@ -0,0 +1,6 @@
1
+ <div id="region" data-scope="scope" data-version="1">contents</div>
2
+ <div id="region_with_snippet">contents<div class="example-snippet" data-snippet="snippet_1" data-version="1">snippet</div></div>
3
+ <div id="region_with_javascript_snippet"><div class="example-snippet" data-snippet="snippet_1" data-version="1">
4
+ <ul id="modifiable-element"></ul>
5
+ <script>$("#modifiable-element").append("<li />");</script>
6
+ </div></div>
@@ -0,0 +1 @@
1
+ <div id="full_region1"></div>
@@ -0,0 +1 @@
1
+ <img id="image_region1" src="foo.jpg" />
@@ -0,0 +1 @@
1
+ <div id="markdown_region1"></div>
@@ -0,0 +1 @@
1
+ <div id="simple_region1"></div>
@@ -0,0 +1,4 @@
1
+ <div id="snippets_region1" data-mercury="snippets"></div>
2
+ <div id="snippets_region2" data-mercury="snippets">
3
+ <div class="example-snippet" data-snippet="snippet_1">12</div>
4
+ </div>
@@ -1,8 +1,7 @@
1
1
  describe "Mercury.Dialog", ->
2
2
 
3
- template 'mercury/dialog.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/dialog.html')
6
5
  $.fx.off = true
7
6
  Mercury.determinedLocale =
8
7
  top: {'hello world!': 'bork! bork!'}
@@ -49,7 +48,7 @@ describe "Mercury.Dialog", ->
49
48
  @preloadSpy = spyOn(Mercury.Dialog.prototype, 'preload').andCallFake(=>)
50
49
 
51
50
  it "builds an element", ->
52
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
51
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
53
52
  html = $('<div>').html(@dialog.element).html()
54
53
  expect(html).toContain('class="mercury-dialog mercury-foo-dialog loading"')
55
54
  expect(html).toContain('style="display:none"')
@@ -70,18 +69,18 @@ describe "Mercury.Dialog", ->
70
69
  @loadSpy = spyOn(Mercury.Dialog.prototype, 'load').andCallFake(=>)
71
70
 
72
71
  it "calls load if configured", ->
73
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test', preload: true})
72
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, preload: true})
74
73
  expect(@loadSpy.callCount).toEqual(1)
75
74
 
76
75
  it "doesn't call load if configured", ->
77
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test', preload: false})
76
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, preload: false})
78
77
  expect(@loadSpy.callCount).toEqual(0)
79
78
 
80
79
 
81
80
  describe "#toggle", ->
82
81
 
83
82
  beforeEach ->
84
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
83
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
85
84
 
86
85
  it "shows or hides", ->
87
86
  expect(@dialog.element.css('display')).toEqual('none')
@@ -94,7 +93,7 @@ describe "Mercury.Dialog", ->
94
93
  describe "#resize", ->
95
94
 
96
95
  beforeEach ->
97
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
96
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
98
97
 
99
98
  it "calls show", ->
100
99
  spy = spyOn(Mercury.Dialog.prototype, 'show').andCallFake(=>)
@@ -105,7 +104,7 @@ describe "Mercury.Dialog", ->
105
104
  describe "#show", ->
106
105
 
107
106
  beforeEach ->
108
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
107
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
109
108
 
110
109
  it "triggers a custom event to hide all other dialogs", ->
111
110
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
@@ -157,7 +156,7 @@ describe "Mercury.Dialog", ->
157
156
  describe "#appear", ->
158
157
 
159
158
  beforeEach ->
160
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
159
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
161
160
 
162
161
  it "animates the dialog in", ->
163
162
  @dialog.appear()
@@ -170,7 +169,7 @@ describe "Mercury.Dialog", ->
170
169
  describe "#hide", ->
171
170
 
172
171
  beforeEach ->
173
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
172
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
174
173
 
175
174
  it "hides the dialog", ->
176
175
  @dialog.element.css({display: 'block'})
@@ -184,7 +183,7 @@ describe "Mercury.Dialog", ->
184
183
  beforeEach ->
185
184
  @spyFunction = ->
186
185
  Mercury.dialogHandlers.foo = ->
187
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
186
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, for: $('#button')})
188
187
 
189
188
  it "does nothing if there's no url", ->
190
189
  spy = spyOn($, 'ajax').andCallFake(=>)
@@ -261,7 +260,7 @@ describe "Mercury.Dialog", ->
261
260
  describe "#loadContent", ->
262
261
 
263
262
  beforeEach ->
264
- @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: '#test'})
263
+ @dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
265
264
 
266
265
  it "sets loaded to be true", ->
267
266
  @dialog.loadContent()
@@ -1,9 +1,8 @@
1
1
  describe "Mercury.dialogHandlers.backColor", ->
2
2
 
3
- template 'mercury/dialogs/backcolor.html'
4
-
5
3
  beforeEach ->
6
- @dialog = {element: $('#test'), button: $('#button')}
4
+ fixture.load('mercury/dialogs/backcolor.html')
5
+ @dialog = {element: $(fixture.el), button: $('#button')}
7
6
  Mercury.dialogHandlers.backColor.call(@dialog)
8
7
 
9
8
  describe "when a .picker or .last-picked element is clicked", ->
@@ -1,9 +1,8 @@
1
1
  describe "Mercury.dialogHandlers.foreColor", ->
2
2
 
3
- template 'mercury/dialogs/forecolor.html'
4
-
5
3
  beforeEach ->
6
- @dialog = {element: $('#test'), button: $('#button')}
4
+ fixture.load('mercury/dialogs/forecolor.html')
5
+ @dialog = {element: $(fixture.el), button: $('#button')}
7
6
  Mercury.dialogHandlers.foreColor.call(@dialog)
8
7
 
9
8
  describe "when a .picker or .last-picked element is clicked", ->
@@ -26,7 +25,7 @@ describe "Mercury.dialogHandlers.foreColor", ->
26
25
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
27
26
  jasmine.simulate.click($('#white').get(0))
28
27
  expect(spy.callCount).toEqual(1)
29
- expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: 'rgb(255, 255, 255)'}])
28
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: '#FFFFFF'}])
30
29
 
31
30
 
32
31
  describe "when any other element is clicked", ->
@@ -1,9 +1,8 @@
1
1
  describe "Mercury.dialogHandlers.formatblock", ->
2
2
 
3
- template 'mercury/dialogs/formatblock.html'
4
-
5
3
  beforeEach ->
6
- @dialog = {element: $('#test')}
4
+ fixture.load('mercury/dialogs/formatblock.html')
5
+ @dialog = {element: $(fixture.el)}
7
6
  Mercury.dialogHandlers.formatblock.call(@dialog)
8
7
 
9
8
  describe "when an element with a data-tag attribute is clicked", ->
@@ -1,9 +1,8 @@
1
1
  describe "Mercury.dialogHandlers.snippetPanel", ->
2
2
 
3
- template 'mercury/dialogs/snippetpanel.html'
4
-
5
3
  beforeEach ->
6
- @dialog = {element: $('#test'), button: $('#button')}
4
+ fixture.load('mercury/dialogs/snippetpanel.html')
5
+ @dialog = {element: $(fixture.el), button: $('#button')}
7
6
  Mercury.dialogHandlers.snippetPanel.call(@dialog)
8
7
 
9
8
  describe "filter", ->
@@ -1,9 +1,8 @@
1
1
  describe "Mercury.dialogHandlers.style", ->
2
2
 
3
- template 'mercury/dialogs/style.html'
4
-
5
3
  beforeEach ->
6
- @dialog = {element: $('#test')}
4
+ fixture.load('mercury/dialogs/style.html')
5
+ @dialog = {element: $(fixture.el)}
7
6
  Mercury.dialogHandlers.style.call(@dialog)
8
7
 
9
8
  describe "when an element with a data-class attribute is clicked", ->
@@ -1,8 +1,7 @@
1
1
  describe "Mercury.lightview", ->
2
2
 
3
- template 'mercury/lightview.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/lightview.html')
6
5
  $.fx.off = true
7
6
  Mercury.displayRect = {fullHeight: 200, width: 1000}
8
7
  Mercury.determinedLocale =
@@ -11,8 +10,7 @@ describe "Mercury.lightview", ->
11
10
 
12
11
  afterEach ->
13
12
  Mercury.config.localization.enabled = false
14
- Mercury.lightview.initialized = false
15
- Mercury.lightview.visible = false
13
+ Mercury.lightview.instance = null
16
14
  $(window).unbind('mercury:refresh')
17
15
  $(window).unbind('mercury:resize')
18
16
  $(document).unbind('keydown')
@@ -20,122 +18,135 @@ describe "Mercury.lightview", ->
20
18
  describe "singleton method", ->
21
19
 
22
20
  beforeEach ->
23
- @showSpy = spyOn(Mercury.lightview, 'show').andCallFake(=>)
21
+ @showSpy = spyOn(Mercury.Lightview.prototype, 'show').andCallFake(=>)
24
22
 
25
23
  it "calls show", ->
26
24
  Mercury.lightview('/foo')
27
25
  expect(@showSpy.callCount).toEqual(1)
28
26
 
29
- it "returns the function object", ->
27
+ it "returns an instance", ->
30
28
  ret = Mercury.lightview('/foo')
31
- expect(ret).toEqual(Mercury.lightview)
29
+ expect(ret).toEqual(Mercury.lightview.instance)
30
+ expect(ret.show).toEqual(Mercury.Lightview.prototype.show)
32
31
 
33
32
 
34
33
  describe "#show", ->
35
34
 
36
35
  beforeEach ->
37
- @initializeSpy = spyOn(Mercury.lightview, 'initialize').andCallFake(=>)
38
- @updateSpy = spyOn(Mercury.lightview, 'update').andCallFake(=>)
39
- @appearSpy = spyOn(Mercury.lightview, 'appear').andCallFake(=>)
36
+ @initializeSpy = spyOn(Mercury.Lightview.prototype, 'initializeLightview').andCallFake(=>)
37
+ @updateSpy = spyOn(Mercury.Lightview.prototype, 'update').andCallFake(=>)
38
+ @appearSpy = spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
39
+
40
+ it "sets options.ujsHandling to true unless set to false", ->
41
+ instance = new Mercury.Lightview()
42
+ instance.show()
43
+ expect(instance.options.ujsHandling).toEqual(true)
44
+ instance = new Mercury.Lightview('', {ujsHandling: false})
45
+ instance.show()
46
+ expect(instance.options.ujsHandling).toEqual(false)
40
47
 
41
48
  it "triggers the focus:window event", ->
42
49
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
43
- Mercury.lightview.show()
50
+ new Mercury.Lightview().show()
44
51
  expect(spy.callCount).toEqual(1)
45
52
  expect(spy.argsForCall[0]).toEqual(['focus:window'])
46
53
 
47
54
  it "calls initialize", ->
48
- Mercury.lightview.show()
55
+ new Mercury.Lightview().show()
49
56
  expect(@initializeSpy.callCount).toEqual(1)
50
57
 
51
58
  describe "if already visible", ->
52
59
 
53
60
  it "calls update", ->
54
- Mercury.lightview.visible = true
55
- Mercury.lightview.show()
61
+ lightview = new Mercury.Lightview()
62
+ lightview.visible = true
63
+ lightview.show()
56
64
  expect(@updateSpy.callCount).toEqual(1)
57
65
 
58
66
  describe "if not visible", ->
59
67
 
60
68
  it "calls appear", ->
61
- Mercury.lightview.show()
69
+ lightview = new Mercury.Lightview()
70
+ lightview.visible = false
71
+ lightview.show()
62
72
  expect(@appearSpy.callCount).toEqual(1)
63
73
 
64
74
 
65
- describe "#initialize", ->
75
+ describe "#initializeLightview", ->
66
76
 
67
77
  beforeEach ->
68
- @buildSpy = spyOn(Mercury.lightview, 'build').andCallFake(=>)
69
- @bindEventsSpy = spyOn(Mercury.lightview, 'bindEvents').andCallFake(=>)
78
+ @buildSpy = spyOn(Mercury.Lightview.prototype, 'build').andCallFake(=>)
79
+ @bindEventsSpy = spyOn(Mercury.Lightview.prototype, 'bindEvents').andCallFake(=>)
80
+ @lightview = new Mercury.Lightview()
70
81
 
71
82
  it "calls build", ->
72
- Mercury.lightview.initialize()
83
+ @lightview.initializeLightview()
73
84
  expect(@buildSpy.callCount).toEqual(1)
74
85
 
75
86
  it "calls bindEvents", ->
76
- Mercury.lightview.initialize()
87
+ @lightview.initializeLightview()
77
88
  expect(@bindEventsSpy.callCount).toEqual(1)
78
89
 
79
90
  it "does nothing if already initialized", ->
80
- Mercury.lightview.initialized = true
81
- Mercury.lightview.initialize()
91
+ @lightview.initialized = true
92
+ @lightview.initializeLightview()
82
93
  expect(@buildSpy.callCount).toEqual(0)
83
94
 
84
95
  it "sets initialized to true", ->
85
- Mercury.lightview.initialize()
86
- expect(Mercury.lightview.initialized).toEqual(true)
96
+ @lightview.initializeLightview()
97
+ expect(@lightview.initialized).toEqual(true)
87
98
 
88
99
 
89
100
  describe "#build", ->
90
101
 
91
102
  beforeEach ->
92
- Mercury.lightview.options = {appendTo: $('#test')}
103
+ @lightview = new Mercury.Lightview('', {appendTo: fixture.el})
93
104
 
94
105
  it "builds an element", ->
95
- Mercury.lightview.build()
96
- expect($('#test .mercury-lightview').length).toEqual(1)
106
+ @lightview.build()
107
+ expect($('.mercury-lightview', fixture.el).length).toEqual(1)
97
108
 
98
109
  it "builds an overlay element", ->
99
- Mercury.lightview.build()
100
- expect($('#test .mercury-lightview-overlay').length).toEqual(1)
110
+ @lightview.build()
111
+ expect($('.mercury-lightview-overlay', fixture.el).length).toEqual(1)
101
112
 
102
113
  it "creates a titleElement", ->
103
- Mercury.lightview.build()
104
- expect($('#test .mercury-lightview-title').length).toEqual(1)
105
- expect($('#test .mercury-lightview-title').html()).toEqual("<span><\/span>")
106
- expect(Mercury.lightview.titleElement).toBeDefined()
114
+ @lightview.build()
115
+ expect($('.mercury-lightview-title', fixture.el).length).toEqual(1)
116
+ expect($('.mercury-lightview-title', fixture.el).html()).toEqual("<span><\/span>")
117
+ expect(@lightview.titleElement).toBeDefined()
107
118
 
108
119
  it "creates a contentElement", ->
109
- Mercury.lightview.build()
110
- expect($('#test .mercury-lightview-content').length).toEqual(1)
111
- expect(Mercury.lightview.contentElement).toBeDefined()
120
+ @lightview.build()
121
+ expect($('.mercury-lightview-content', fixture.el).length).toEqual(1)
122
+ expect(@lightview.contentElement).toBeDefined()
112
123
 
113
124
  it "appends to any element", ->
114
- Mercury.lightview.options = {appendTo: $('#lightview_container')}
115
- Mercury.lightview.build()
125
+ @lightview.options = {appendTo: $('#lightview_container')}
126
+ @lightview.build()
116
127
  expect($('#lightview_container .mercury-lightview').length).toEqual(1)
117
128
  expect($('#lightview_container .mercury-lightview-overlay').length).toEqual(1)
118
129
 
119
130
  it "creates a close button if asked to in the options", ->
120
- Mercury.lightview.options.closeButton = true
121
- Mercury.lightview.build()
122
- expect($('#test .mercury-lightview-close').length).toEqual(1)
131
+ @lightview.options.closeButton = true
132
+ @lightview.build()
133
+ expect($('.mercury-lightview-close', fixture.el).length).toEqual(1)
123
134
 
124
135
 
125
136
  describe "observed events", ->
126
137
 
127
138
  beforeEach ->
128
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
139
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
129
140
 
130
141
  describe "without a close button", ->
131
142
 
132
143
  beforeEach ->
133
- Mercury.lightview('/foo', {appendTo: $('#test')})
144
+ @lightview = Mercury.lightview('/foo', {appendTo: fixture.el})
134
145
 
135
146
  describe "custom event: refresh", ->
136
147
 
137
148
  it "calls resize telling it stay visible", ->
138
- spy = spyOn(Mercury.lightview, 'resize').andCallFake(=>)
149
+ spy = spyOn(@lightview, 'resize').andCallFake(=>)
139
150
  Mercury.trigger('refresh')
140
151
  expect(spy.callCount).toEqual(1)
141
152
  expect(spy.argsForCall[0]).toEqual([true])
@@ -143,46 +154,46 @@ describe "Mercury.lightview", ->
143
154
  describe "custom event: resize", ->
144
155
 
145
156
  beforeEach ->
146
- Mercury.lightview.visible = true
157
+ @lightview.visible = true
147
158
 
148
159
  it "calls position", ->
149
- spy = spyOn(Mercury.lightview, 'position').andCallFake(=>)
160
+ spy = spyOn(@lightview, 'position').andCallFake(=>)
150
161
  Mercury.trigger('resize')
151
162
  expect(spy.callCount).toEqual(1)
152
163
 
153
164
  describe "clicking on the overlay", ->
154
165
 
155
166
  it "calls hide", ->
156
- spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
167
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
157
168
  jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
158
169
  expect(spy.callCount).toEqual(1)
159
170
 
160
171
  describe "pressing esc on document", ->
161
172
 
162
173
  beforeEach ->
163
- Mercury.lightview.visible = true
174
+ @lightview.visible = true
164
175
 
165
176
  it "calls hide", ->
166
- spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
177
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
167
178
  jasmine.simulate.keydown(document, {keyCode: 27})
168
179
  expect(spy.callCount).toEqual(1)
169
180
 
170
181
  describe "with a close button", ->
171
182
 
172
183
  beforeEach ->
173
- Mercury.lightview('/foo', {appendTo: $('#test'), closeButton: true})
184
+ @lightview = Mercury.lightview('/foo', {appendTo: fixture.el, closeButton: true})
174
185
 
175
186
  describe "clicking on the close button", ->
176
187
 
177
188
  it "calls hide", ->
178
- spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
189
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
179
190
  jasmine.simulate.click($('.mercury-lightview-close').get(0))
180
191
  expect(spy.callCount).toEqual(1)
181
192
 
182
193
  describe "clicking on the overlay", ->
183
194
 
184
195
  it "doesn't call hide", ->
185
- spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
196
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
186
197
  jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
187
198
  expect(spy.callCount).toEqual(0)
188
199
 
@@ -190,8 +201,8 @@ describe "Mercury.lightview", ->
190
201
 
191
202
  it "sets a success that will load the contents of the response", ->
192
203
  options = {}
193
- spy = spyOn(Mercury.lightview, 'loadContent').andCallFake(=>)
194
- Mercury.lightview.element.trigger('ajax:beforeSend', [null, options])
204
+ spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
205
+ @lightview.element.trigger('ajax:beforeSend', [null, options])
195
206
  expect(options.success).toBeDefined()
196
207
  options.success('new content')
197
208
  expect(spy.callCount).toEqual(1)
@@ -201,74 +212,76 @@ describe "Mercury.lightview", ->
201
212
  describe "#appear", ->
202
213
 
203
214
  beforeEach ->
204
- Mercury.lightview.visible = true
205
- spyOn(Mercury.lightview, 'update').andCallFake(=>)
206
- @loadSpy = spyOn(Mercury.lightview, 'load').andCallFake(=>)
207
- @positionSpy = spyOn(Mercury.lightview, 'position').andCallFake(=>)
208
- Mercury.lightview('/blank.html', {appendTo: $('#test')})
215
+ @lightview = new Mercury.Lightview('/blank.html', {appendTo: fixture.el})
216
+ @lightview.visible = true
217
+ spyOn(@lightview, 'update').andCallFake(=>)
218
+ @loadSpy = spyOn(@lightview, 'load').andCallFake(=>)
219
+ @positionSpy = spyOn(@lightview, 'position').andCallFake(=>)
220
+ @lightview.show()
209
221
 
210
222
  it "calls position", ->
211
- Mercury.lightview.appear()
223
+ @lightview.appear()
212
224
  expect(@positionSpy.callCount).toEqual(1)
213
225
 
214
226
  it "shows the overlay", ->
215
227
  expect($('.mercury-lightview-overlay').css('display')).toEqual('none')
216
- Mercury.lightview.appear()
228
+ @lightview.appear()
217
229
  expect($('.mercury-lightview-overlay').css('display')).toEqual('block')
218
230
 
219
231
  it "animates the overlay to full opacity", ->
220
232
  expect($('.mercury-lightview-overlay').css('opacity')).toEqual('0')
221
- Mercury.lightview.appear()
233
+ @lightview.appear()
222
234
  expect($('.mercury-lightview-overlay').css('opacity')).toEqual('1')
223
235
 
224
236
  it "calls setTitle", ->
225
- spy = spyOn(Mercury.lightview, 'setTitle').andCallFake(=>)
226
- Mercury.lightview.appear()
237
+ spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
238
+ @lightview.appear()
227
239
  expect(spy.callCount).toEqual(1)
228
240
 
229
241
  it "shows the element", ->
230
242
  expect($('.mercury-lightview').css('display')).toEqual('none')
231
- Mercury.lightview.appear()
243
+ @lightview.appear()
232
244
  expect($('.mercury-lightview').css('display')).toEqual('block')
233
245
 
234
246
  it "animates the element opacity", ->
235
247
  expect($('.mercury-lightview').css('opacity')).toEqual('0')
236
- Mercury.lightview.appear()
248
+ @lightview.appear()
237
249
  expect($('.mercury-lightview').css('opacity')).toEqual('1')
238
250
 
239
251
  it "sets visible to true", ->
240
- Mercury.lightview.visible = false
241
- Mercury.lightview.appear()
242
- expect(Mercury.lightview.visible).toEqual(true)
252
+ @lightview.visible = false
253
+ @lightview.appear()
254
+ expect(@lightview.visible).toEqual(true)
243
255
 
244
256
  it "calls load", ->
245
- Mercury.lightview.appear()
257
+ @lightview.appear()
246
258
  expect(@loadSpy.callCount).toEqual(1)
247
259
 
248
260
 
249
261
  describe "#resize", ->
250
262
 
251
263
  beforeEach ->
252
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
253
- Mercury.lightview('/blank.html', {appendTo: $('#test')})
254
- Mercury.lightview.contentPane = $()
264
+ @lightview = new Mercury.Lightview('/blank.html', {appendTo: fixture.el})
265
+ spyOn(@lightview, 'appear').andCallFake(=>)
266
+ @lightview.show()
267
+ @lightview.contentPane = $()
255
268
 
256
269
  it "will keep the content element visible if asked to do so", ->
257
270
  $('.mercury-lightview-content').css('visibility', 'visible')
258
- Mercury.lightview.resize(true)
271
+ @lightview.resize(true)
259
272
  expect($('.mercury-lightview-content').css('visibility')).toEqual('visible')
260
273
 
261
274
  it "resizes the element and adjusts it's position when empty", ->
262
275
  $('.mercury-lightview').css({display: 'block', visibility: 'visible', top: 0})
263
- Mercury.lightview.resize()
276
+ @lightview.resize()
264
277
  expect($('.mercury-lightview').width()).toEqual(300)
265
278
  expect($('.mercury-lightview').offset()).toEqual({top: 35, left: 350})
266
279
  expect($('.mercury-lightview').height()).toEqual(150)
267
280
 
268
281
  it "resizes the element and adjusts it's position when it has content", ->
269
- Mercury.lightview.loadContent('<div style="width:600px;height:400px"></div>')
282
+ @lightview.loadContent('<div style="width:600px;height:400px"></div>')
270
283
  $('.mercury-lightview').css({display: 'block', visibility: 'visible', top: 0})
271
- Mercury.lightview.resize()
284
+ @lightview.resize()
272
285
  expect($('.mercury-lightview').width()).toEqual(300)
273
286
  expect($('.mercury-lightview').offset()).toEqual({top: 20, left: 350})
274
287
  expect($('.mercury-lightview').height()).toEqual(180)
@@ -277,7 +290,7 @@ describe "Mercury.lightview", ->
277
290
  describe "#position", ->
278
291
 
279
292
  beforeEach ->
280
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
293
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
281
294
 
282
295
  # todo: test this
283
296
  it "positions the element", ->
@@ -286,10 +299,11 @@ describe "Mercury.lightview", ->
286
299
  describe "#update", ->
287
300
 
288
301
  beforeEach ->
289
- @resetSpy = spyOn(Mercury.lightview, 'reset').andCallFake(=>)
290
- @resizeSpy = spyOn(Mercury.lightview, 'resize').andCallFake(=>)
291
- @loadSpy = spyOn(Mercury.lightview, 'load').andCallFake(=>)
292
- Mercury.lightview.update()
302
+ @lightview = new Mercury.Lightview()
303
+ @resetSpy = spyOn(@lightview, 'reset').andCallFake(=>)
304
+ @resizeSpy = spyOn(@lightview, 'resize').andCallFake(=>)
305
+ @loadSpy = spyOn(@lightview, 'load').andCallFake(=>)
306
+ @lightview.update()
293
307
 
294
308
  it "calls reset", ->
295
309
  expect(@resetSpy.callCount).toEqual(1)
@@ -304,37 +318,37 @@ describe "Mercury.lightview", ->
304
318
  describe "#load", ->
305
319
 
306
320
  beforeEach ->
307
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
321
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
308
322
  @ajaxSpy = spyOn($, 'ajax')
309
- Mercury.lightview('/blank.html', {appendTo: $('#test')})
323
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el})
310
324
 
311
325
  it "does nothing if there's no url", ->
312
- Mercury.lightview.url = null
326
+ @lightview.url = null
313
327
  $('.mercury-lightview').removeClass('loading')
314
- Mercury.lightview.load()
328
+ @lightview.load()
315
329
  expect($('.mercury-lightview').hasClass('loading')).toEqual(false)
316
330
 
317
331
  it "sets the loading class on the element", ->
318
- Mercury.lightview.load()
332
+ @lightview.load()
319
333
  expect($('.mercury-lightview').hasClass('loading')).toEqual(true)
320
334
 
321
335
  it "calls setTitle", ->
322
- spy = spyOn(Mercury.lightview, 'setTitle').andCallFake(=>)
323
- Mercury.lightview.load()
336
+ spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
337
+ @lightview.load()
324
338
  expect(spy.callCount).toEqual(1)
325
339
 
326
340
  describe "on a preloaded view", ->
327
341
 
328
342
  beforeEach ->
329
- @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
343
+ @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
330
344
  Mercury.preloadedViews = {'/blank.html': 'this is the preloaded content'}
331
345
 
332
346
  afterEach ->
333
347
  Mercury.preloadedViews = {}
334
348
 
335
349
  it "calls loadContent with the content in the preloaded view", ->
336
- spy = spyOn(Mercury.lightview, 'loadContent').andCallFake(=>)
337
- Mercury.lightview.load()
350
+ spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
351
+ @lightview.load()
338
352
  expect(@setTimeoutSpy.callCount).toEqual(1)
339
353
  expect(spy.callCount).toEqual(1)
340
354
 
@@ -343,7 +357,7 @@ describe "Mercury.lightview", ->
343
357
  it "makes an ajax request", ->
344
358
  @ajaxSpy.andCallFake(=>)
345
359
  spyOn(Mercury, 'ajaxHeaders').andCallFake(=> {'X-CSRFToken': 'f00'})
346
- Mercury.lightview.load()
360
+ @lightview.load()
347
361
  expect(@ajaxSpy.callCount).toEqual(1)
348
362
  expect(@ajaxSpy.argsForCall[0][1]['headers']).toEqual({'X-CSRFToken': 'f00'})
349
363
 
@@ -353,8 +367,8 @@ describe "Mercury.lightview", ->
353
367
  @ajaxSpy.andCallFake((url, options) => options.success('return value'))
354
368
 
355
369
  it "calls loadContent and passes the returned data", ->
356
- spy = spyOn(Mercury.lightview, 'loadContent').andCallFake(=>)
357
- Mercury.lightview.load()
370
+ spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
371
+ @lightview.load()
358
372
  expect(spy.callCount).toEqual(1)
359
373
  expect(spy.argsForCall[0]).toEqual(['return value'])
360
374
 
@@ -365,14 +379,14 @@ describe "Mercury.lightview", ->
365
379
 
366
380
  it "calls hide", ->
367
381
  spyOn(window, 'alert').andCallFake(=>)
368
- spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
369
- Mercury.lightview.load()
382
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
383
+ @lightview.load()
370
384
  expect(spy.callCount).toEqual(1)
371
385
 
372
386
  it "alerts an error message", ->
373
- spyOn(Mercury.lightview, 'hide').andCallFake(=>)
387
+ spyOn(@lightview, 'hide').andCallFake(=>)
374
388
  spy = spyOn(window, 'alert').andCallFake(=>)
375
- Mercury.lightview.load()
389
+ @lightview.load()
376
390
  expect(spy.callCount).toEqual(1)
377
391
  expect(spy.argsForCall[0]).toEqual(['Mercury was unable to load /blank.html for the lightview.'])
378
392
 
@@ -380,86 +394,110 @@ describe "Mercury.lightview", ->
380
394
  describe "#loadContent", ->
381
395
 
382
396
  beforeEach ->
383
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
384
- @resizeSpy = spyOn(Mercury.lightview, 'resize').andCallFake(=>)
385
- Mercury.lightview('/blank.html', {appendTo: $('#test'), title: 'title'})
397
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
398
+ @resizeSpy = spyOn(Mercury.Lightview.prototype, 'resize').andCallFake(=>)
399
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
386
400
 
387
401
  it "accepts options and sets them to the instance options", ->
388
- Mercury.lightview.loadContent('content', {title: 'title'})
389
- expect(Mercury.lightview.options).toEqual({title: 'title'})
402
+ @lightview.loadContent('content', {title: 'title'})
403
+ expect(@lightview.options).toEqual({title: 'title'})
390
404
 
391
- it "calls initialize", ->
392
- spy = spyOn(Mercury.lightview, 'initialize').andCallFake(=>)
393
- Mercury.lightview.loadContent('content')
405
+ it "calls initializeLightview", ->
406
+ spy = spyOn(@lightview, 'initializeLightview').andCallFake(=>)
407
+ @lightview.loadContent('content')
394
408
  expect(spy.callCount).toEqual(1)
395
409
 
396
410
  it "calls setTitle", ->
397
- spy = spyOn(Mercury.lightview, 'setTitle').andCallFake(=>)
398
- Mercury.lightview.loadContent('content')
411
+ spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
412
+ @lightview.loadContent('content')
399
413
  expect(spy.callCount).toEqual(1)
400
414
 
401
415
  it "sets loaded to true", ->
402
- Mercury.lightview.loaded = false
403
- Mercury.lightview.loadContent('content')
404
- expect(Mercury.lightview.loaded).toEqual(true)
416
+ @lightview.loaded = false
417
+ @lightview.loadContent('content')
418
+ expect(@lightview.loaded).toEqual(true)
405
419
 
406
420
  it "removes the loading class", ->
407
421
  $('.mercury-lightview').addClass('loading')
408
- Mercury.lightview.loadContent('content')
422
+ @lightview.loadContent('content')
409
423
  expect($('.mercury-lightview').hasClass('loading')).toEqual(false)
410
424
 
411
425
  it "sets the content elements html to whatever was passed", ->
412
- Mercury.lightview.loadContent('<span>content</span>')
426
+ @lightview.loadContent('<span>content</span>')
413
427
  expect($('.mercury-lightview-content').html()).toEqual('<span>content</span>')
414
428
 
415
429
  it "hides the contentElement", ->
416
430
  $('.mercury-lightview-content').css('display', 'block')
417
- Mercury.lightview.loadContent('content')
431
+ @lightview.loadContent('content')
418
432
  expect($('.mercury-lightview-content').css('display')).toEqual('none')
419
433
  expect($('.mercury-lightview-content').css('visibility')).toEqual('hidden')
420
434
 
421
435
  it "calls an afterLoad callback (if provided in options)", ->
422
436
  callCount = 0
423
- Mercury.lightview.loadContent('content', {afterLoad: => callCount += 1})
437
+ @lightview.loadContent('content', {afterLoad: => callCount += 1})
424
438
  expect(callCount).toEqual(1)
425
439
 
426
- it "calls a handler method if one is set in lightviewHandlers", ->
427
- callCount = 0
428
- Mercury.lightviewHandlers['foo'] = => callCount += 1
429
- Mercury.lightview.loadContent('content', {handler: 'foo'})
430
- expect(callCount).toEqual(1)
440
+ it "calls a handler method if one is set in lightviewHandlers"#, ->
441
+ # callCount = 0
442
+ # Mercury.lightviewHandlers['foo'] = => callCount += 1
443
+ # @lightview.loadContent('content', {handler: 'foo'})
444
+ # expect(callCount).toEqual(1)
431
445
 
432
446
  it "translates the content if configured", ->
433
447
  Mercury.config.localization.enabled = true
434
- Mercury.lightview.loadContent('<span>foo</span>')
448
+ @lightview.loadContent('<span>foo</span>')
435
449
  expect($('.mercury-lightview-content').html()).toEqual('<span>Bork!</span>')
436
450
 
451
+ it "makes any element with the lightview-close class close the lightview", ->
452
+ spy = spyOn(@lightview, 'hide').andCallFake(=>)
453
+ @lightview.loadContent('<span class="lightview-close">foo</span>')
454
+ jasmine.simulate.click(@lightview.contentElement.find('.lightview-close').get(0))
455
+ expect(spy.callCount).toEqual(1)
456
+
437
457
  it "calls resize", ->
438
- Mercury.lightview.loadContent('content')
458
+ @lightview.loadContent('content')
439
459
  expect(@resizeSpy.callCount).toEqual(1)
440
460
 
441
461
 
442
462
  describe "#setTitle", ->
443
463
 
444
464
  beforeEach ->
445
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
446
- Mercury.lightview('/blank.html', {appendTo: $('#test'), title: 'title'})
465
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
466
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
447
467
 
448
468
  it "sets the the title contents to what was provided in the options", ->
449
- Mercury.lightview.options = {title: 'new title'}
450
- Mercury.lightview.setTitle()
469
+ @lightview.options = {title: 'new title'}
470
+ @lightview.setTitle()
451
471
  expect($('.mercury-lightview-title span').html()).toEqual('new title')
452
472
 
453
473
 
474
+ describe "#serializeForm", ->
475
+
476
+ beforeEach ->
477
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
478
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
479
+
480
+ describe "without a form", ->
481
+
482
+ it "returns an empty object", ->
483
+ expect(@lightview.serializeForm()).toEqual({})
484
+
485
+ describe "with a form", ->
486
+
487
+ it "returns an object of the serialized form", ->
488
+ @lightview.loadContent('<form><input name="options[foo]" value="bar"/></form>')
489
+ expect(@lightview.serializeForm()).toEqual({options: {foo: 'bar'}})
490
+
491
+
454
492
  describe "#reset", ->
455
493
 
456
494
  beforeEach ->
457
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
458
- Mercury.lightview('/blank.html', {appendTo: $('#test'), title: 'title'})
495
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
496
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
459
497
 
460
498
  it "clears the title and content elements", ->
461
499
  $('.mercury-lightview-content').html('content')
462
- Mercury.lightview.reset()
500
+ @lightview.reset()
463
501
  expect($('.mercury-lightview-content').html()).toEqual('')
464
502
  expect($('.mercury-lightview-title span').html()).toEqual('')
465
503
 
@@ -467,31 +505,31 @@ describe "Mercury.lightview", ->
467
505
  describe "#hide", ->
468
506
 
469
507
  beforeEach ->
470
- spyOn(Mercury.lightview, 'appear').andCallFake(=>)
471
- Mercury.lightview('/blank.html', {appendTo: $('#test')})
508
+ spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
509
+ @lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el})
472
510
 
473
511
  it "triggers the focus:frame event", ->
474
512
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
475
- Mercury.lightview.hide()
513
+ @lightview.hide()
476
514
  expect(spy.callCount).toEqual(1)
477
515
  expect(spy.argsForCall[0]).toEqual(['focus:frame'])
478
516
 
479
517
  it "hides the element", ->
480
- Mercury.lightview.element.css('display:block')
481
- Mercury.lightview.hide()
518
+ @lightview.element.css('display:block')
519
+ @lightview.hide()
482
520
  expect($('.mercury-lightview').css('display')).toEqual('none')
483
521
 
484
522
  it "hides the overlay element", ->
485
- Mercury.lightview.overlay.css('display:block')
486
- Mercury.lightview.hide()
523
+ @lightview.overlay.css('display:block')
524
+ @lightview.hide()
487
525
  expect($('.mercury-lightview-overlay').css('display')).toEqual('none')
488
526
 
489
527
  it "calls reset", ->
490
- spy = spyOn(Mercury.lightview, 'reset').andCallFake(=>)
491
- Mercury.lightview.hide()
528
+ spy = spyOn(@lightview, 'reset').andCallFake(=>)
529
+ @lightview.hide()
492
530
  expect(spy.callCount).toEqual(1)
493
531
 
494
532
  it "sets visible to false", ->
495
- Mercury.lightview.visible = true
496
- Mercury.lightview.hide()
497
- expect(Mercury.lightview.visible).toEqual(false)
533
+ @lightview.visible = true
534
+ @lightview.hide()
535
+ expect(@lightview.visible).toEqual(false)