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
@@ -1,10 +1,9 @@
1
1
  describe "Mercury.modalHandlers.htmlEditor", ->
2
2
 
3
- template 'mercury/modals/htmleditor.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/modals/htmleditor.html')
6
5
  @modal =
7
- element: $('#test')
6
+ element: $(fixture.el)
8
7
  hide: ->
9
8
  Mercury.region =
10
9
  content: -> '<span>html \ncontent</span>'
@@ -13,7 +12,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
13
12
  describe "loading", ->
14
13
 
15
14
  it "sets the value of the textarea", ->
16
- expect($('#test textarea').val()).toEqual('<span>html \ncontent</span>')
15
+ expect($('textarea', fixture.el).val()).toEqual('<span>html \ncontent</span>')
17
16
 
18
17
 
19
18
  describe "submitting", ->
@@ -22,7 +21,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
22
21
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
23
22
  jasmine.simulate.click($('#submit').get(0))
24
23
  expect(spy.callCount).toEqual(1)
25
- expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html content</span>'}])
24
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html \ncontent</span>'}])
26
25
 
27
26
  it "hides the modal", ->
28
27
  spy = spyOn(@modal, 'hide').andCallFake(=>)
@@ -1,10 +1,9 @@
1
1
  describe "Mercury.modalHandlers.insertCharacter", ->
2
2
 
3
- template 'mercury/modals/insertcharacter.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/modals/insertcharacter.html')
6
5
  @modal =
7
- element: $('#test')
6
+ element: $(fixture.el)
8
7
  hide: ->
9
8
  @modalHideSpy = spyOn(@modal, 'hide').andCallFake(=>)
10
9
  Mercury.modalHandlers.insertCharacter.call(@modal)
@@ -1,19 +1,19 @@
1
1
  describe "Mercury.modalHandlers.insertLink", ->
2
2
 
3
- template 'mercury/modals/insertlink.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/modals/insertlink.html')
6
5
  Mercury.region = null
7
6
  @modal =
8
- element: $('#test')
7
+ element: $(fixture.el)
9
8
  hide: ->
10
9
  resize: ->
10
+ @insertLink = $.extend(@modal, Mercury.modalHandlers.insertLink)
11
11
  window.mercuryInstance = {document: $(document)}
12
12
 
13
13
  describe "initializing", ->
14
14
 
15
15
  beforeEach ->
16
- Mercury.modalHandlers.insertLink.call(@modal)
16
+ @insertLink.initialize()
17
17
 
18
18
  it "loads all links with a name into the existing bookmarks pulldown", ->
19
19
  options = $('#link_existing_bookmark').html()
@@ -25,28 +25,35 @@ describe "Mercury.modalHandlers.insertLink", ->
25
25
  describe "clicking on a radio button (in a label)", ->
26
26
 
27
27
  beforeEach ->
28
- Mercury.modalHandlers.insertLink.call(@modal)
28
+ @insertLink.initialize()
29
29
 
30
30
  it "focuses the next input with a selectable class", ->
31
31
  spy = spyOn($.fn, 'focus').andCallFake(=>)
32
- jasmine.simulate.click($('#checkbox1').get(0))
32
+ jasmine.simulate.click($('input[value=external_url]').get(0))
33
33
  expect(spy.callCount).toEqual(1)
34
34
 
35
35
 
36
36
  describe "focusing an input", ->
37
37
 
38
38
  beforeEach ->
39
- Mercury.modalHandlers.insertLink.call(@modal)
39
+ @insertLink.initialize()
40
40
 
41
41
  it "checks the corresponding checkbox", ->
42
42
  $('#link_existing_bookmark').focus()
43
- expect($('#checkbox2').get(0).checked).toEqual(true)
43
+ expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
44
44
 
45
45
 
46
46
  describe "changing the link target", ->
47
47
 
48
48
  it "shows options for whatever was selected", ->
49
+ $('#link_target').val('popup')
50
+ @insertLink.onChangeTarget()
51
+ expect($('#popup_options').is(':visible')).toEqual(true)
52
+
49
53
  it "calls resize", ->
54
+ spy = spyOn(@modal, 'resize')
55
+ @insertLink.onChangeTarget()
56
+ expect(spy.callCount).toEqual(1)
50
57
 
51
58
 
52
59
  describe "when editing", ->
@@ -56,12 +63,11 @@ describe "Mercury.modalHandlers.insertLink", ->
56
63
  beforeEach ->
57
64
  Mercury.region = selection: => {
58
65
  commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo'),
59
- textContent: -> 'content'
60
- }
61
- Mercury.modalHandlers.insertLink.call(@modal)
66
+ }
67
+ @insertLink.initialize()
62
68
 
63
69
  it "hides the link text input", ->
64
- expect($('#link_text_container').css('display')).toEqual('none')
70
+ expect($('#link_text_container').is(':visible')).toEqual(false)
65
71
 
66
72
  it "pre-fills the link url input", ->
67
73
  expect($('#link_external_url').val()).toEqual('http://cnn.com')
@@ -69,17 +75,16 @@ describe "Mercury.modalHandlers.insertLink", ->
69
75
  it "selects the target if one's available", ->
70
76
  expect($('#link_target').val()).toEqual('_top')
71
77
 
72
- it "fills the content", ->
73
- expect($('#link_text').val()).toEqual('content')
74
-
75
78
  describe "a javascript popup link", ->
76
79
 
77
80
  beforeEach ->
78
- Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}).html('foo')}
79
- Mercury.modalHandlers.insertLink.call(@modal)
81
+ Mercury.region = selection: => {
82
+ commonAncestor: -> $('<a>', {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}).html('foo')
83
+ }
84
+ @insertLink.initialize()
80
85
 
81
86
  it "hides the link text input", ->
82
- expect($('#link_text_container').css('display')).toEqual('none')
87
+ expect($('#link_text_container').is(':visible')).toEqual(false)
83
88
 
84
89
  it "pre-fills the link url input", ->
85
90
  expect($('#link_external_url').val()).toEqual('http://cnn.com')
@@ -94,11 +99,13 @@ describe "Mercury.modalHandlers.insertLink", ->
94
99
  describe "a bookmark link", ->
95
100
 
96
101
  beforeEach ->
97
- Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')}
98
- Mercury.modalHandlers.insertLink.call(@modal)
102
+ Mercury.region = selection: => {
103
+ commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')
104
+ }
105
+ @insertLink.initialize()
99
106
 
100
107
  it "hides the link text input", ->
101
- expect($('#link_text_container').css('display')).toEqual('none')
108
+ expect($('#link_text_container').is(':visible')).toEqual(false)
102
109
 
103
110
  it "checks the existing bookmark radio", ->
104
111
  expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
@@ -109,8 +116,10 @@ describe "Mercury.modalHandlers.insertLink", ->
109
116
  describe "a bookmark target", ->
110
117
 
111
118
  beforeEach ->
112
- Mercury.region = selection: => {commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')}
113
- Mercury.modalHandlers.insertLink.call(@modal)
119
+ Mercury.region = selection: => {
120
+ commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')
121
+ }
122
+ @insertLink.initialize()
114
123
 
115
124
  it "hides the link text input", ->
116
125
  expect($('#link_text_container').css('display')).toEqual('none')
@@ -122,18 +131,80 @@ describe "Mercury.modalHandlers.insertLink", ->
122
131
  expect($('#link_new_bookmark').val()).toEqual('link3')
123
132
 
124
133
 
134
+ describe "validating", ->
135
+
136
+ beforeEach ->
137
+ @insertLink.initialize()
138
+ @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
139
+ $('#link_text').val('foo')
140
+
141
+ it "displays an error if there's no content", ->
142
+ $('#link_text').val('')
143
+ @insertLink.validateForm()
144
+ expect(@insertLink.valid).toEqual(false)
145
+ expect($('#link_text').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
146
+
147
+ describe "a standard link", ->
148
+
149
+ it "displays an error", ->
150
+ @insertLink.validateForm()
151
+ expect(@insertLink.valid).toEqual(false)
152
+ expect($('#link_external_url').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
153
+
154
+ it "doesn't submit", ->
155
+ @insertLink.validateForm()
156
+ expect(@triggerSpy.callCount).toEqual(0)
157
+
158
+ describe "a bookmark link", ->
159
+
160
+ beforeEach ->
161
+ jasmine.simulate.click($('input[value=existing_bookmark]').get(0))
162
+ $('#link_existing_bookmark').html('').val('')
163
+
164
+ it "displays an error", ->
165
+ @insertLink.validateForm()
166
+ expect(@insertLink.valid).toEqual(false)
167
+ expect($('#link_existing_bookmark').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
168
+
169
+ it "doesn't submit", ->
170
+ @insertLink.validateForm()
171
+ expect(@triggerSpy.callCount).toEqual(0)
172
+
173
+ describe "a bookmark target", ->
174
+
175
+ beforeEach ->
176
+ jasmine.simulate.click($('input[value=new_bookmark]').get(0))
177
+
178
+ it "displays an error", ->
179
+ @insertLink.validateForm()
180
+ expect(@insertLink.valid).toEqual(false)
181
+ expect($('#link_new_bookmark').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
182
+
183
+ it "doesn't submit", ->
184
+ @insertLink.validateForm()
185
+ expect(@triggerSpy.callCount).toEqual(0)
186
+
187
+
125
188
  describe "submitting", ->
126
189
 
127
190
  describe "a new link", ->
128
191
 
129
192
  beforeEach ->
130
- Mercury.modalHandlers.insertLink.call(@modal)
193
+ @insertLink.initialize()
131
194
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
132
195
  $('#link_text').val('foo')
133
196
 
197
+ it "doesn't submit unless it's valid", ->
198
+ $('#link_text').val('')
199
+ spy = spyOn(@modal, 'hide')
200
+ jasmine.simulate.click($('input[type=submit]').get(0))
201
+ expect(spy.callCount).toEqual(0)
202
+ expect(@insertLink.valid).toEqual(false)
203
+
134
204
  it "hides the modal", ->
135
- spy = spyOn(@modal, 'hide').andCallFake(=>)
136
- jasmine.simulate.click($('#submit').get(0))
205
+ $('#link_external_url').val('http://cnn.com')
206
+ spy = spyOn(@modal, 'hide')
207
+ jasmine.simulate.click($('input[type=submit]').get(0))
137
208
  expect(spy.callCount).toEqual(1)
138
209
 
139
210
  describe "as a standard link", ->
@@ -143,7 +214,7 @@ describe "Mercury.modalHandlers.insertLink", ->
143
214
  $('#link_target').val('_top')
144
215
 
145
216
  it "triggers an action with the proper values", ->
146
- jasmine.simulate.click($('#submit').get(0))
217
+ jasmine.simulate.click($('input[type=submit]').get(0))
147
218
  expect(@triggerSpy.callCount).toEqual(1)
148
219
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
149
220
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -158,7 +229,7 @@ describe "Mercury.modalHandlers.insertLink", ->
158
229
  $('#link_popup_height').val('42')
159
230
 
160
231
  it "triggers an action with the proper values", ->
161
- jasmine.simulate.click($('#submit').get(0))
232
+ jasmine.simulate.click($('input[type=submit]').get(0))
162
233
  expect(@triggerSpy.callCount).toEqual(1)
163
234
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
164
235
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -171,7 +242,7 @@ describe "Mercury.modalHandlers.insertLink", ->
171
242
  $('input[value=existing_bookmark]').prop('checked', true)
172
243
 
173
244
  it "triggers an action with the proper values", ->
174
- jasmine.simulate.click($('#submit').get(0))
245
+ jasmine.simulate.click($('input[type=submit]').get(0))
175
246
  expect(@triggerSpy.callCount).toEqual(1)
176
247
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
177
248
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -184,7 +255,7 @@ describe "Mercury.modalHandlers.insertLink", ->
184
255
  $('input[value=new_bookmark]').prop('checked', true)
185
256
 
186
257
  it "triggers an action with the proper values", ->
187
- jasmine.simulate.click($('#submit').get(0))
258
+ jasmine.simulate.click($('input[type=submit]').get(0))
188
259
  expect(@triggerSpy.callCount).toEqual(1)
189
260
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
190
261
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -194,14 +265,16 @@ describe "Mercury.modalHandlers.insertLink", ->
194
265
 
195
266
  beforeEach ->
196
267
  @existingLink = $('<a>', {name: 'link3'}).html('foo')
197
- Mercury.region = selection: => {commonAncestor: => @existingLink}
198
- Mercury.modalHandlers.insertLink.call(@modal)
268
+ Mercury.region = selection: => {
269
+ commonAncestor: => @existingLink
270
+ }
271
+ @insertLink.initialize()
199
272
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
200
273
  $('#link_text').val('foo')
201
274
 
202
275
  it "hides the modal", ->
203
276
  spy = spyOn(@modal, 'hide').andCallFake(=>)
204
- jasmine.simulate.click($('#submit').get(0))
277
+ jasmine.simulate.click($('input[type=submit]').get(0))
205
278
  expect(spy.callCount).toEqual(1)
206
279
 
207
280
  describe "as a standard link", ->
@@ -212,7 +285,7 @@ describe "Mercury.modalHandlers.insertLink", ->
212
285
  $('input[value=external_url]').prop('checked', true)
213
286
 
214
287
  it "triggers an action with the proper values", ->
215
- jasmine.simulate.click($('#submit').get(0))
288
+ jasmine.simulate.click($('input[type=submit]').get(0))
216
289
  expect(@triggerSpy.callCount).toEqual(1)
217
290
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
218
291
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('replaceLink')
@@ -1,43 +1,44 @@
1
1
  describe "Mercury.modalHandlers.insertMedia", ->
2
2
 
3
- template 'mercury/modals/insertmedia.html'
4
-
5
3
  beforeEach ->
4
+ fixture.load('mercury/modals/insertmedia.html')
6
5
  Mercury.region = null
7
- spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
6
+ spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
8
7
  @modal =
9
- element: $('#test')
8
+ element: $(fixture.el)
10
9
  hide: ->
11
10
  resize: ->
11
+ @insertMedia = $.extend(@modal, Mercury.modalHandlers.insertMedia)
12
+ window.mercuryInstance = {document: $(document)}
12
13
 
13
14
  describe "clicking on a radio button (in a label)", ->
14
15
 
15
16
  beforeEach ->
16
- Mercury.modalHandlers.insertMedia.call(@modal)
17
+ @insertMedia.initialize()
17
18
 
18
19
  it "focuses the next input with a selectable class", ->
19
20
  spy = spyOn($.fn, 'focus').andCallFake(=>)
20
- jasmine.simulate.click($('#checkbox1').get(0))
21
+ jasmine.simulate.click($('input[value=image_url]').get(0))
21
22
  expect(spy.callCount).toEqual(1)
22
23
 
23
24
 
24
25
  describe "focusing an input", ->
25
26
 
26
27
  beforeEach ->
27
- Mercury.modalHandlers.insertMedia.call(@modal)
28
+ @insertMedia.initialize()
28
29
 
29
30
  it "checks the corresponding checkbox", ->
30
31
  $('#media_youtube_url').focus()
31
- expect($('#checkbox2').get(0).checked).toEqual(true)
32
+ expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
32
33
 
33
34
  it "hides all the option divs", ->
34
35
  $('#media_youtube_url').focus()
35
- expect($('#image_url').css('display')).toEqual('none')
36
- expect($('#vimeo_url').css('display')).toEqual('none')
36
+ expect($('#image_url_options').css('display')).toEqual('none')
37
+ expect($('#vimeo_url_options').css('display')).toEqual('none')
37
38
 
38
39
  it "shows the options for the item that was focused", ->
39
40
  $('#media_youtube_url').focus()
40
- expect($('#youtube_url').css('display')).toNotEqual('none')
41
+ expect($('#youtube_url_options').css('display')).toNotEqual('none')
41
42
 
42
43
  it "calls resize", ->
43
44
  spy = spyOn(@modal, 'resize').andCallFake(=>)
@@ -51,30 +52,33 @@ describe "Mercury.modalHandlers.insertMedia", ->
51
52
 
52
53
  beforeEach ->
53
54
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
54
- @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
55
+ @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right', style: 'float: left;'})}
55
56
  Mercury.region = selection: => @selection
56
- Mercury.modalHandlers.insertMedia.call(@modal)
57
+ @insertMedia.initialize()
57
58
 
58
59
  it "pre-fills the image url", ->
59
60
  expect($('#media_image_url').val()).toEqual('/foo.gif')
60
61
 
61
62
  it "focuses the url input", ->
62
- expect(@focusSpy.callCount).toEqual(1)
63
+ expect(@focusSpy.callCount).toEqual(2)
63
64
  expect($('input[value=image_url]').get(0).checked).toEqual(true)
64
65
 
65
66
  it "sets the image alignment option", ->
66
67
  expect($('#media_image_alignment').val()).toEqual('right')
67
68
 
69
+ it "sets the image float option", ->
70
+ expect($('#media_image_float').val()).toEqual('left')
71
+
68
72
  describe "an existing youtube video", ->
69
73
 
70
74
  beforeEach ->
71
75
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
72
- @selection = {is: -> $('<iframe>', {src: 'http://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
76
+ @selection = {is: -> $('<iframe>', {src: 'https://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
73
77
  Mercury.region = selection: => @selection
74
- Mercury.modalHandlers.insertMedia.call(@modal)
78
+ @insertMedia.initialize()
75
79
 
76
80
  it "pre-fills the url", ->
77
- expect($('#media_youtube_url').val()).toEqual('http://youtu.be/foo')
81
+ expect($('#media_youtube_url').val()).toEqual('https://youtu.be/foo')
78
82
 
79
83
  it "focuses the url input", ->
80
84
  expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
@@ -91,7 +95,7 @@ describe "Mercury.modalHandlers.insertMedia", ->
91
95
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
92
96
  @selection = {is: -> $('<iframe>', {src: 'http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff', style: 'width:100px;height:42px'})}
93
97
  Mercury.region = selection: => @selection
94
- Mercury.modalHandlers.insertMedia.call(@modal)
98
+ @insertMedia.initialize()
95
99
 
96
100
  it "pre-fills the url", ->
97
101
  expect($('#media_vimeo_url').val()).toEqual('http://vimeo.com/foo')
@@ -106,15 +110,67 @@ describe "Mercury.modalHandlers.insertMedia", ->
106
110
  expect($('#media_vimeo_height').val()).toEqual('42')
107
111
 
108
112
 
113
+ describe "validating", ->
114
+
115
+ beforeEach ->
116
+ @insertMedia.initialize()
117
+ @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
118
+
119
+ describe "an image", ->
120
+
121
+ it "displays an error", ->
122
+ @insertMedia.validateForm()
123
+ expect(@insertMedia.valid).toEqual(false)
124
+ expect($('#media_image_url').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
125
+
126
+ it "doesn't submit", ->
127
+ @insertMedia.validateForm()
128
+ expect(@triggerSpy.callCount).toEqual(0)
129
+
130
+ describe "a youtube video", ->
131
+
132
+ beforeEach ->
133
+ $('input[value=youtube_url]').prop('checked', true)
134
+
135
+ it "displays an error", ->
136
+ @insertMedia.validateForm()
137
+ expect(@insertMedia.valid).toEqual(false)
138
+ expect($('#media_youtube_url').closest('.control-group').find('.error-message').html()).toEqual("is invalid")
139
+
140
+ it "doesn't submit", ->
141
+ @insertMedia.validateForm()
142
+ expect(@triggerSpy.callCount).toEqual(0)
143
+
144
+ describe "a vimeo video", ->
145
+ beforeEach ->
146
+ $('input[value=vimeo_url]').prop('checked', true)
147
+
148
+ it "displays an error", ->
149
+ @insertMedia.validateForm()
150
+ expect(@insertMedia.valid).toEqual(false)
151
+ expect($('#media_vimeo_url').closest('.control-group').find('.error-message').html()).toEqual("is invalid")
152
+
153
+ it "doesn't submit", ->
154
+ @insertMedia.validateForm()
155
+ expect(@triggerSpy.callCount).toEqual(0)
156
+
157
+
109
158
  describe "submitting", ->
110
159
 
111
160
  beforeEach ->
112
- Mercury.modalHandlers.insertMedia.call(@modal)
161
+ @insertMedia.initialize()
113
162
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
114
163
 
164
+ it "doesn't submit unless it's valid", ->
165
+ spy = spyOn(@modal, 'hide')
166
+ jasmine.simulate.click($('input[type=submit]').get(0))
167
+ expect(spy.callCount).toEqual(0)
168
+ expect(@insertMedia.valid).toEqual(false)
169
+
115
170
  it "hides the modal", ->
116
- spy = spyOn(@modal, 'hide').andCallFake(=>)
117
- jasmine.simulate.click($('#submit').get(0))
171
+ $('#media_image_url').val('foo.gif')
172
+ spy = spyOn(@modal, 'hide')
173
+ jasmine.simulate.click($('input[type=submit]').get(0))
118
174
  expect(spy.callCount).toEqual(1)
119
175
 
120
176
  describe "an image", ->
@@ -122,13 +178,14 @@ describe "Mercury.modalHandlers.insertMedia", ->
122
178
  beforeEach ->
123
179
  $('#media_image_url').val('http://domain/foo.gif')
124
180
  $('#media_image_alignment').val('right')
181
+ $('#media_image_float').val('left')
125
182
 
126
183
  it "triggers an action with the proper values", ->
127
- jasmine.simulate.click($('#submit').get(0))
184
+ jasmine.simulate.click($('input[type=submit]').get(0))
128
185
  expect(@triggerSpy.callCount).toEqual(1)
129
186
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
130
187
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertImage')
131
- expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right'})
188
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right', style: 'float: left;'})
132
189
 
133
190
  describe "a youtube video", ->
134
191
 
@@ -139,7 +196,8 @@ describe "Mercury.modalHandlers.insertMedia", ->
139
196
  $('input[value=youtube_url]').prop('checked', true)
140
197
 
141
198
  it "triggers an action with the proper values", ->
142
- jasmine.simulate.click($('#submit').get(0))
199
+ $('#media_youtube_url').val('http://youtu.be/foo')
200
+ jasmine.simulate.click($('input[type=submit]').get(0))
143
201
  expect(@triggerSpy.callCount).toEqual(1)
144
202
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
145
203
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
@@ -148,16 +206,27 @@ describe "Mercury.modalHandlers.insertMedia", ->
148
206
  expect(value).toContain('42px')
149
207
  expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
150
208
 
209
+ it "triggers an action with the proper values using https", ->
210
+ $('#media_youtube_url').val('https://youtu.be/foo')
211
+ jasmine.simulate.click($('input[type=submit]').get(0))
212
+ expect(@triggerSpy.callCount).toEqual(1)
213
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
214
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
215
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
216
+ expect(value).toContain('100px')
217
+ expect(value).toContain('42px')
218
+ expect(value).toContain('src="https://www.youtube.com/embed/foo?wmode=transparent"')
219
+
151
220
  describe "a vimeo video", ->
152
221
 
153
222
  beforeEach ->
154
- $('#media_vimeo_url').val('http://vimeo.com/foo')
155
223
  $('#media_vimeo_width').val(100)
156
224
  $('#media_vimeo_height').val('42')
157
225
  $('input[value=vimeo_url]').prop('checked', true)
158
226
 
159
227
  it "triggers an action with the proper values", ->
160
- jasmine.simulate.click($('#submit').get(0))
228
+ $('#media_vimeo_url').val('http://vimeo.com/foo')
229
+ jasmine.simulate.click($('input[type=submit]').get(0))
161
230
  expect(@triggerSpy.callCount).toEqual(1)
162
231
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
163
232
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
@@ -165,3 +234,14 @@ describe "Mercury.modalHandlers.insertMedia", ->
165
234
  expect(value).toContain('100px')
166
235
  expect(value).toContain('42px')
167
236
  expect(value).toContain('http://player.vimeo.com/video/foo?title=1&amp;byline=1&amp;portrait=0&amp;color=ffffff')
237
+
238
+ it "triggers an action with the proper values using https", ->
239
+ $('#media_vimeo_url').val('https://vimeo.com/foo')
240
+ jasmine.simulate.click($('input[type=submit]').get(0))
241
+ expect(@triggerSpy.callCount).toEqual(1)
242
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
243
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
244
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
245
+ expect(value).toContain('100px')
246
+ expect(value).toContain('42px')
247
+ expect(value).toContain('https://player.vimeo.com/video/foo?title=1&amp;byline=1&amp;portrait=0&amp;color=ffffff')