kiteditor 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. data/{lib/generators/mercury/install/images/templates → app/controllers/mercury}/images_controller.rb +0 -0
  2. data/{lib/generators/mercury/install/images/templates/ar_paperclip_image.rb → app/models/mercury/image.rb} +0 -7
  3. data/app/views/layouts/mercury.html.erb +20 -10
  4. data/app/views/mercury/modals/character.html +1 -1
  5. data/app/views/mercury/modals/htmleditor.html +7 -3
  6. data/app/views/mercury/modals/link.html +51 -37
  7. data/app/views/mercury/modals/media.html +0 -102
  8. data/app/views/mercury/modals/table.html +73 -79
  9. data/app/views/mercury/panels/snippets.html +1 -6
  10. data/app/views/mercury/snippets/example/options.html.erb +27 -23
  11. data/{lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb → db/migrate/20110526035601_create_mercury_images.rb} +0 -0
  12. data/features/loading/loading.feature +2 -5
  13. data/features/loading/user_interface.feature +7 -9
  14. data/features/regions/{full → editable}/advanced_editing.feature +0 -0
  15. data/features/regions/editable/basic_editing.feature +195 -0
  16. data/features/regions/{full → editable}/inserting_links.feature +19 -20
  17. data/features/regions/{full → editable}/inserting_media.feature +18 -36
  18. data/features/regions/{full → editable}/inserting_snippets.feature +18 -28
  19. data/features/regions/{full → editable}/inserting_special_characters.feature +2 -2
  20. data/features/regions/editable/inserting_tables.feature +109 -0
  21. data/features/regions/{full → editable}/pasting.feature +0 -0
  22. data/features/regions/{full → editable}/uploading_images.feature +0 -0
  23. data/features/regions/{markdown → markupable}/advanced_editing.feature +0 -0
  24. data/features/regions/{markdown → markupable}/basic_editing.feature +0 -0
  25. data/features/regions/{markdown → markupable}/inserting_links.feature +0 -0
  26. data/features/regions/{markdown → markupable}/inserting_media.feature +0 -0
  27. data/features/regions/{markdown → markupable}/inserting_snippets.feature +0 -0
  28. data/features/regions/{markdown → markupable}/inserting_special_characters.feature +0 -0
  29. data/features/regions/{markdown → markupable}/inserting_tables.feature +0 -0
  30. data/features/regions/{image → markupable}/uploading_images.feature +0 -0
  31. data/features/regions/{snippets → snippetable}/advanced_editing.feature +0 -0
  32. data/features/regions/{snippets → snippetable}/basic_editing.feature +0 -0
  33. data/features/regions/{snippets → snippetable}/inserting_snippets.feature +0 -0
  34. data/features/saving/saving.feature +8 -8
  35. data/features/step_definitions/mercury_steps.rb +438 -1
  36. data/features/support/env.rb +1 -11
  37. data/{lib/mercury/cucumber → features}/support/mercury_contents.rb +3 -3
  38. data/{lib/mercury/cucumber → features}/support/mercury_selectors.rb +20 -0
  39. data/features/support/selectors.rb +0 -23
  40. data/lib/generators/mercury/install/install_generator.rb +23 -12
  41. data/lib/generators/mercury/install/{images/templates → templates}/mongoid_paperclip_image.rb +0 -0
  42. data/lib/mercury/authentication.rb +0 -1
  43. data/lib/mercury-rails.rb +2 -1
  44. data/spec/javascripts/mercury/{dialog_spec.coffee → dialog_spec.js.coffee} +12 -11
  45. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -2
  46. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +4 -3
  47. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +3 -2
  48. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +3 -2
  49. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +3 -2
  50. data/spec/javascripts/mercury/lightview_spec.js.coffee +142 -180
  51. data/spec/javascripts/mercury/mercury_spec.js.coffee +13 -19
  52. data/spec/javascripts/mercury/modal_spec.js.coffee +148 -192
  53. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +5 -4
  54. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +3 -2
  55. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +34 -107
  56. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +26 -106
  57. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +3 -2
  58. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +40 -50
  59. data/spec/javascripts/mercury/page_editor_spec.js.coffee +80 -124
  60. data/spec/javascripts/mercury/palette_spec.js.coffee +5 -4
  61. data/spec/javascripts/mercury/panel_spec.js.coffee +12 -9
  62. data/spec/javascripts/mercury/region_spec.js.coffee +17 -22
  63. data/spec/javascripts/mercury/regions/{full_spec.js.coffee → editable_spec.js.coffee} +28 -26
  64. data/spec/javascripts/mercury/regions/{markdown_spec.js.coffee → markupable_spec.js.coffee} +34 -32
  65. data/spec/javascripts/mercury/regions/{snippets_spec.js.coffee → snippetable_spec.js.coffee} +55 -54
  66. data/spec/javascripts/mercury/select_spec.js.coffee +5 -4
  67. data/spec/javascripts/mercury/snippet_spec.js.coffee +16 -92
  68. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +16 -31
  69. data/spec/javascripts/mercury/statusbar_spec.js.coffee +10 -9
  70. data/spec/javascripts/mercury/table_editor_spec.js.coffee +2 -1
  71. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +9 -7
  72. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +26 -55
  73. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
  74. data/spec/javascripts/mercury/toolbar_spec.js.coffee +14 -43
  75. data/spec/javascripts/mercury/tooltip_spec.js.coffee +2 -1
  76. data/spec/javascripts/mercury/uploader_spec.js.coffee +33 -47
  77. data/spec/javascripts/{support/event_simulation.js → spec_helper.js} +2 -0
  78. data/spec/javascripts/{fixtures → templates}/mercury/dialog.html +0 -0
  79. data/spec/javascripts/{fixtures → templates}/mercury/dialogs/backcolor.html +0 -0
  80. data/spec/javascripts/{fixtures → templates}/mercury/dialogs/forecolor.html +0 -0
  81. data/spec/javascripts/{fixtures → templates}/mercury/dialogs/formatblock.html +0 -0
  82. data/spec/javascripts/{fixtures → templates}/mercury/dialogs/snippetpanel.html +0 -0
  83. data/spec/javascripts/{fixtures → templates}/mercury/dialogs/style.html +0 -0
  84. data/spec/javascripts/{fixtures → templates}/mercury/lightview.html +0 -0
  85. data/spec/javascripts/{fixtures → templates}/mercury/modal.html +0 -0
  86. data/spec/javascripts/{fixtures → templates}/mercury/modals/htmleditor.html +0 -0
  87. data/spec/javascripts/{fixtures → templates}/mercury/modals/insertcharacter.html +0 -0
  88. data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
  89. data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
  90. data/spec/javascripts/{fixtures → templates}/mercury/modals/insertsnippet.html +0 -0
  91. data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
  92. data/spec/javascripts/{fixtures → templates}/mercury/page_editor.html +4 -4
  93. data/spec/javascripts/{fixtures → templates}/mercury/palette.html +0 -0
  94. data/spec/javascripts/{fixtures → templates}/mercury/panel.html +0 -0
  95. data/spec/javascripts/templates/mercury/region.html +2 -0
  96. data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
  97. data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
  98. data/spec/javascripts/{fixtures → templates}/mercury/select.html +0 -0
  99. data/spec/javascripts/{fixtures → templates}/mercury/snippet.html +0 -0
  100. data/spec/javascripts/{fixtures → templates}/mercury/snippet_toolbar.html +0 -0
  101. data/spec/javascripts/{fixtures → templates}/mercury/statusbar.html +0 -0
  102. data/spec/javascripts/{fixtures → templates}/mercury/table_editor.html +0 -0
  103. data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button.html +0 -0
  104. data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button_group.html +0 -0
  105. data/spec/javascripts/{fixtures → templates}/mercury/toolbar.expander.html +0 -0
  106. data/spec/javascripts/{fixtures → templates}/mercury/toolbar.html +0 -0
  107. data/spec/javascripts/{fixtures → templates}/mercury/tooltip.html +0 -0
  108. data/spec/javascripts/{fixtures → templates}/mercury/uploader.html +0 -0
  109. data/{app → vendor}/assets/images/mercury/button.png +0 -0
  110. data/{app → vendor}/assets/images/mercury/close.png +0 -0
  111. data/{app → vendor}/assets/images/mercury/loading-dark.gif +0 -0
  112. data/{app → vendor}/assets/images/mercury/loading-light.gif +0 -0
  113. data/{app → vendor}/assets/images/mercury/missing-image.png +0 -0
  114. data/{app → vendor}/assets/images/mercury/search-icon.png +0 -0
  115. data/{app → vendor}/assets/images/mercury/temp-logo.png +0 -0
  116. data/{app/assets/javascripts → vendor/assets/javascripts/mercury/dependencies}/jquery-1.7.js +0 -0
  117. data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
  118. data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.additions.js +13 -103
  119. data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
  120. data/{app → vendor}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
  121. data/{app → vendor}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
  122. data/{app → vendor}/assets/javascripts/mercury/dialog.js.coffee +0 -0
  123. data/{app → vendor}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
  124. data/{app → vendor}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
  125. data/{app → vendor}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
  126. data/{app → vendor}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
  127. data/{app → vendor}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
  128. data/{app → vendor}/assets/javascripts/mercury/finalize.js.coffee +0 -0
  129. data/{app → vendor}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
  130. data/{app → vendor}/assets/javascripts/mercury/lightview.js.coffee +17 -38
  131. data/{features/regions/markdown/uploading_images.feature → vendor/assets/javascripts/mercury/locales/da.locale.js.coffee} +0 -0
  132. data/{app → vendor}/assets/javascripts/mercury/locales/de.locale.js.coffee +10 -4
  133. data/{app → vendor}/assets/javascripts/mercury/locales/es.locale.js.coffee +9 -3
  134. data/{app → vendor}/assets/javascripts/mercury/locales/example.local.js.coffee +5 -3
  135. data/{app → vendor}/assets/javascripts/mercury/locales/fr.locale.js.coffee +9 -3
  136. data/{app → vendor}/assets/javascripts/mercury/locales/it.locale.js.coffee +9 -3
  137. data/{app → vendor}/assets/javascripts/mercury/locales/ko.local.js.coffee +10 -4
  138. data/{app → vendor}/assets/javascripts/mercury/locales/nl.locale.js.coffee +9 -3
  139. data/{app → vendor}/assets/javascripts/mercury/locales/pt.locale.js.coffee +9 -3
  140. data/{app → vendor}/assets/javascripts/mercury/locales/sv.local.js.coffee +9 -3
  141. data/{app → vendor}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +9 -3
  142. data/{app → vendor}/assets/javascripts/mercury/mercury.js.coffee +1 -10
  143. data/{app → vendor}/assets/javascripts/mercury/modal.js.coffee +40 -62
  144. data/{app → vendor}/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -3
  145. data/{app → vendor}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +0 -1
  146. data/{app → vendor}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +0 -2
  147. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
  148. data/{app → vendor}/assets/javascripts/mercury/native_extensions.js.coffee +6 -0
  149. data/{app → vendor}/assets/javascripts/mercury/page_editor.js.coffee +50 -84
  150. data/{app → vendor}/assets/javascripts/mercury/palette.js.coffee +1 -1
  151. data/{app → vendor}/assets/javascripts/mercury/panel.js.coffee +2 -3
  152. data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
  153. data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
  154. data/{app → vendor}/assets/javascripts/mercury/region.js.coffee +17 -18
  155. data/{app/assets/javascripts/mercury/regions/full.js.coffee → vendor/assets/javascripts/mercury/regions/editable.js.coffee} +31 -41
  156. data/{app/assets/javascripts/mercury/regions/markdown.js.coffee → vendor/assets/javascripts/mercury/regions/markupable.js.coffee} +24 -29
  157. data/{app → vendor}/assets/javascripts/mercury/regions/simple.js.coffee +54 -11
  158. data/{app/assets/javascripts/mercury/regions/snippets.js.coffee → vendor/assets/javascripts/mercury/regions/snippetable.js.coffee} +9 -10
  159. data/{app → vendor}/assets/javascripts/mercury/select.js.coffee +1 -1
  160. data/{app → vendor}/assets/javascripts/mercury/snippet_toolbar.js.coffee +6 -19
  161. data/{app → vendor}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
  162. data/{app → vendor}/assets/javascripts/mercury/support/history.js +0 -0
  163. data/{app → vendor}/assets/javascripts/mercury/table_editor.js.coffee +0 -16
  164. data/{app → vendor}/assets/javascripts/mercury/toolbar.button.js.coffee +30 -45
  165. data/{app → vendor}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
  166. data/{app → vendor}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
  167. data/{app → vendor}/assets/javascripts/mercury/toolbar.js.coffee +6 -10
  168. data/{app → vendor}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
  169. data/{app → vendor}/assets/javascripts/mercury/uploader.js.coffee +19 -37
  170. data/{app → vendor}/assets/javascripts/mercury.js +87 -60
  171. data/vendor/assets/javascripts/mercury_loader.js +193 -0
  172. data/vendor/assets/javascripts/mercury_overrides.js +6 -0
  173. data/{app → vendor}/assets/stylesheets/mercury/all_images.css.erb +2 -6
  174. data/{app → vendor}/assets/stylesheets/mercury/dialog.css +8 -21
  175. data/{app → vendor}/assets/stylesheets/mercury/lightview.css +56 -6
  176. data/vendor/assets/stylesheets/mercury/mercury.css +151 -0
  177. data/{app → vendor}/assets/stylesheets/mercury/modal.css +32 -15
  178. data/{app → vendor}/assets/stylesheets/mercury/statusbar.css +0 -0
  179. data/{app → vendor}/assets/stylesheets/mercury/toolbar.css +1 -4
  180. data/{app → vendor}/assets/stylesheets/mercury/tooltip.css +0 -0
  181. data/{app → vendor}/assets/stylesheets/mercury/uploader.css +4 -4
  182. data/{app → vendor}/assets/stylesheets/mercury.css +5 -1
  183. data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
  184. metadata +197 -367
  185. data/POST_INSTALL +0 -21
  186. data/app/assets/images/mercury/default-snippet.png +0 -0
  187. data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  188. data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  189. data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  190. data/app/assets/images/mercury/toolbar/primary/action.png +0 -0
  191. data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  192. data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  193. data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  194. data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  195. data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  196. data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  197. data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  198. data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
  199. data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
  200. data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
  201. data/app/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
  202. data/app/assets/images/mercury/toolbar/primary/tools.png +0 -0
  203. data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
  204. data/app/assets/images/mercury/toolbar/primary/user.png +0 -0
  205. data/app/assets/images/mercury/toolbar/snippets/buttons.png +0 -0
  206. data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +0 -201
  207. data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +0 -208
  208. data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +0 -209
  209. data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +0 -213
  210. data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +0 -200
  211. data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +0 -200
  212. data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +0 -203
  213. data/app/assets/javascripts/mercury/mercury-compiled.js +0 -10720
  214. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +0 -152
  215. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +0 -132
  216. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -68
  217. data/app/assets/javascripts/mercury/regions/image.js.coffee +0 -93
  218. data/app/assets/javascripts/mercury/snippet.js.coffee +0 -136
  219. data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +0 -61
  220. data/app/assets/stylesheets/_mercury-sass.scss +0 -33
  221. data/app/assets/stylesheets/mercury/bootstrap-ish.css +0 -1367
  222. data/app/assets/stylesheets/mercury/bootstrap-overrides.css +0 -61
  223. data/app/assets/stylesheets/mercury/mercury.css +0 -43
  224. data/app/helpers/mercury_helper.rb +0 -7
  225. data/app/views/layouts/mercury.html.haml +0 -19
  226. data/app/views/layouts/mercury.html.slim +0 -19
  227. data/app/views/mercury/snippets/no_options/preview.html.erb +0 -1
  228. data/config/routes.rb +0 -9
  229. data/features/generators/authentication.feature +0 -10
  230. data/features/generators/images.feature +0 -41
  231. data/features/generators/install.feature +0 -21
  232. data/features/regions/full/basic_editing.feature +0 -198
  233. data/features/regions/full/inserting_tables.feature +0 -109
  234. data/features/regions/simple/basic_editing.feature +0 -5
  235. data/features/step_definitions/custom_web_steps.rb +0 -22
  236. data/features/step_definitions/generator_steps.rb +0 -23
  237. data/features/support/aruba.rb +0 -28
  238. data/lib/generators/mercury/install/authentication/authentication_generator.rb +0 -17
  239. data/lib/generators/mercury/install/images/images_generator.rb +0 -47
  240. data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +0 -408
  241. data/lib/mercury/cucumber/step_definitions.rb +0 -13
  242. data/lib/mercury/engine.rb +0 -19
  243. data/lib/mercury/rails.rb +0 -5
  244. data/lib/mercury/version.rb +0 -3
  245. data/spec/dummy/Rakefile +0 -7
  246. data/spec/dummy/app/assets/javascripts/application.js +0 -0
  247. data/spec/dummy/app/assets/javascripts/prototype.js +0 -6082
  248. data/spec/dummy/app/assets/stylesheets/application.css.scss +0 -110
  249. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  250. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  251. data/spec/dummy/app/views/layouts/mercury.html.erb +0 -28
  252. data/spec/dummy/config/application.rb +0 -58
  253. data/spec/dummy/config/boot.rb +0 -10
  254. data/spec/dummy/config/database.yml +0 -10
  255. data/spec/dummy/config/environment.rb +0 -5
  256. data/spec/dummy/config/environments/development.rb +0 -37
  257. data/spec/dummy/config/environments/production.rb +0 -67
  258. data/spec/dummy/config/environments/test.rb +0 -37
  259. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  260. data/spec/dummy/config/initializers/inflections.rb +0 -15
  261. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  262. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  263. data/spec/dummy/config/initializers/session_store.rb +0 -8
  264. data/spec/dummy/config/initializers/teabag.rb +0 -9
  265. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  266. data/spec/dummy/config/locales/en.yml +0 -5
  267. data/spec/dummy/config/routes.rb +0 -5
  268. data/spec/dummy/config.ru +0 -4
  269. data/spec/dummy/db/.gitkeep +0 -0
  270. data/spec/dummy/public/500.html +0 -25
  271. data/spec/dummy/public/blank.html +0 -1
  272. data/spec/dummy/public/favicon.ico +0 -0
  273. data/spec/dummy/public/images/bunny.gif +0 -0
  274. data/spec/dummy/public/images/bunny2.jpg +0 -0
  275. data/spec/dummy/public/index.html +0 -279
  276. data/spec/dummy/script/rails +0 -6
  277. data/spec/javascripts/fixtures/mercury/modals/insertlink.html +0 -67
  278. data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +0 -87
  279. data/spec/javascripts/fixtures/mercury/modals/inserttable.html +0 -73
  280. data/spec/javascripts/fixtures/mercury/region.html +0 -6
  281. data/spec/javascripts/fixtures/mercury/regions/full.html +0 -1
  282. data/spec/javascripts/fixtures/mercury/regions/image.html +0 -1
  283. data/spec/javascripts/fixtures/mercury/regions/markdown.html +0 -1
  284. data/spec/javascripts/fixtures/mercury/regions/simple.html +0 -1
  285. data/spec/javascripts/fixtures/mercury/regions/snippets.html +0 -4
  286. data/spec/javascripts/mercury/regions/image_spec.js.coffee +0 -33
  287. data/spec/javascripts/mercury/regions/simple_spec.js.coffee +0 -32
  288. data/spec/javascripts/spec_helper.coffee +0 -4
  289. data/spec/teabag_env.rb +0 -32
@@ -1,9 +1,10 @@
1
1
  describe "Mercury.modalHandlers.htmlEditor", ->
2
2
 
3
+ template 'mercury/modals/htmleditor.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/modals/htmleditor.html')
5
6
  @modal =
6
- element: $(fixture.el)
7
+ element: $('#test')
7
8
  hide: ->
8
9
  Mercury.region =
9
10
  content: -> '<span>html \ncontent</span>'
@@ -12,7 +13,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
12
13
  describe "loading", ->
13
14
 
14
15
  it "sets the value of the textarea", ->
15
- expect($('textarea', fixture.el).val()).toEqual('<span>html \ncontent</span>')
16
+ expect($('#test textarea').val()).toEqual('<span>html \ncontent</span>')
16
17
 
17
18
 
18
19
  describe "submitting", ->
@@ -21,7 +22,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
21
22
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
22
23
  jasmine.simulate.click($('#submit').get(0))
23
24
  expect(spy.callCount).toEqual(1)
24
- expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html \ncontent</span>'}])
25
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html content</span>'}])
25
26
 
26
27
  it "hides the modal", ->
27
28
  spy = spyOn(@modal, 'hide').andCallFake(=>)
@@ -1,9 +1,10 @@
1
1
  describe "Mercury.modalHandlers.insertCharacter", ->
2
2
 
3
+ template 'mercury/modals/insertcharacter.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/modals/insertcharacter.html')
5
6
  @modal =
6
- element: $(fixture.el)
7
+ element: $('#test')
7
8
  hide: ->
8
9
  @modalHideSpy = spyOn(@modal, 'hide').andCallFake(=>)
9
10
  Mercury.modalHandlers.insertCharacter.call(@modal)
@@ -1,19 +1,19 @@
1
1
  describe "Mercury.modalHandlers.insertLink", ->
2
2
 
3
+ template 'mercury/modals/insertlink.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/modals/insertlink.html')
5
6
  Mercury.region = null
6
7
  @modal =
7
- element: $(fixture.el)
8
+ element: $('#test')
8
9
  hide: ->
9
10
  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
- @insertLink.initialize()
16
+ Mercury.modalHandlers.insertLink.call(@modal)
17
17
 
18
18
  it "loads all links with a name into the existing bookmarks pulldown", ->
19
19
  options = $('#link_existing_bookmark').html()
@@ -25,35 +25,28 @@ describe "Mercury.modalHandlers.insertLink", ->
25
25
  describe "clicking on a radio button (in a label)", ->
26
26
 
27
27
  beforeEach ->
28
- @insertLink.initialize()
28
+ Mercury.modalHandlers.insertLink.call(@modal)
29
29
 
30
30
  it "focuses the next input with a selectable class", ->
31
31
  spy = spyOn($.fn, 'focus').andCallFake(=>)
32
- jasmine.simulate.click($('input[value=external_url]').get(0))
32
+ jasmine.simulate.click($('#checkbox1').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
- @insertLink.initialize()
39
+ Mercury.modalHandlers.insertLink.call(@modal)
40
40
 
41
41
  it "checks the corresponding checkbox", ->
42
42
  $('#link_existing_bookmark').focus()
43
- expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
43
+ expect($('#checkbox2').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
-
53
49
  it "calls resize", ->
54
- spy = spyOn(@modal, 'resize')
55
- @insertLink.onChangeTarget()
56
- expect(spy.callCount).toEqual(1)
57
50
 
58
51
 
59
52
  describe "when editing", ->
@@ -63,11 +56,12 @@ describe "Mercury.modalHandlers.insertLink", ->
63
56
  beforeEach ->
64
57
  Mercury.region = selection: => {
65
58
  commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo'),
66
- }
67
- @insertLink.initialize()
59
+ textContent: -> 'content'
60
+ }
61
+ Mercury.modalHandlers.insertLink.call(@modal)
68
62
 
69
63
  it "hides the link text input", ->
70
- expect($('#link_text_container').is(':visible')).toEqual(false)
64
+ expect($('#link_text_container').css('display')).toEqual('none')
71
65
 
72
66
  it "pre-fills the link url input", ->
73
67
  expect($('#link_external_url').val()).toEqual('http://cnn.com')
@@ -75,16 +69,17 @@ describe "Mercury.modalHandlers.insertLink", ->
75
69
  it "selects the target if one's available", ->
76
70
  expect($('#link_target').val()).toEqual('_top')
77
71
 
72
+ it "fills the content", ->
73
+ expect($('#link_text').val()).toEqual('content')
74
+
78
75
  describe "a javascript popup link", ->
79
76
 
80
77
  beforeEach ->
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()
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)
85
80
 
86
81
  it "hides the link text input", ->
87
- expect($('#link_text_container').is(':visible')).toEqual(false)
82
+ expect($('#link_text_container').css('display')).toEqual('none')
88
83
 
89
84
  it "pre-fills the link url input", ->
90
85
  expect($('#link_external_url').val()).toEqual('http://cnn.com')
@@ -99,13 +94,11 @@ describe "Mercury.modalHandlers.insertLink", ->
99
94
  describe "a bookmark link", ->
100
95
 
101
96
  beforeEach ->
102
- Mercury.region = selection: => {
103
- commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')
104
- }
105
- @insertLink.initialize()
97
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')}
98
+ Mercury.modalHandlers.insertLink.call(@modal)
106
99
 
107
100
  it "hides the link text input", ->
108
- expect($('#link_text_container').is(':visible')).toEqual(false)
101
+ expect($('#link_text_container').css('display')).toEqual('none')
109
102
 
110
103
  it "checks the existing bookmark radio", ->
111
104
  expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
@@ -116,10 +109,8 @@ describe "Mercury.modalHandlers.insertLink", ->
116
109
  describe "a bookmark target", ->
117
110
 
118
111
  beforeEach ->
119
- Mercury.region = selection: => {
120
- commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')
121
- }
122
- @insertLink.initialize()
112
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')}
113
+ Mercury.modalHandlers.insertLink.call(@modal)
123
114
 
124
115
  it "hides the link text input", ->
125
116
  expect($('#link_text_container').css('display')).toEqual('none')
@@ -131,80 +122,18 @@ describe "Mercury.modalHandlers.insertLink", ->
131
122
  expect($('#link_new_bookmark').val()).toEqual('link3')
132
123
 
133
124
 
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
-
188
125
  describe "submitting", ->
189
126
 
190
127
  describe "a new link", ->
191
128
 
192
129
  beforeEach ->
193
- @insertLink.initialize()
130
+ Mercury.modalHandlers.insertLink.call(@modal)
194
131
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
195
132
  $('#link_text').val('foo')
196
133
 
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
-
204
134
  it "hides the modal", ->
205
- $('#link_external_url').val('http://cnn.com')
206
- spy = spyOn(@modal, 'hide')
207
- jasmine.simulate.click($('input[type=submit]').get(0))
135
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
136
+ jasmine.simulate.click($('#submit').get(0))
208
137
  expect(spy.callCount).toEqual(1)
209
138
 
210
139
  describe "as a standard link", ->
@@ -214,7 +143,7 @@ describe "Mercury.modalHandlers.insertLink", ->
214
143
  $('#link_target').val('_top')
215
144
 
216
145
  it "triggers an action with the proper values", ->
217
- jasmine.simulate.click($('input[type=submit]').get(0))
146
+ jasmine.simulate.click($('#submit').get(0))
218
147
  expect(@triggerSpy.callCount).toEqual(1)
219
148
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
220
149
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -229,7 +158,7 @@ describe "Mercury.modalHandlers.insertLink", ->
229
158
  $('#link_popup_height').val('42')
230
159
 
231
160
  it "triggers an action with the proper values", ->
232
- jasmine.simulate.click($('input[type=submit]').get(0))
161
+ jasmine.simulate.click($('#submit').get(0))
233
162
  expect(@triggerSpy.callCount).toEqual(1)
234
163
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
235
164
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -242,7 +171,7 @@ describe "Mercury.modalHandlers.insertLink", ->
242
171
  $('input[value=existing_bookmark]').prop('checked', true)
243
172
 
244
173
  it "triggers an action with the proper values", ->
245
- jasmine.simulate.click($('input[type=submit]').get(0))
174
+ jasmine.simulate.click($('#submit').get(0))
246
175
  expect(@triggerSpy.callCount).toEqual(1)
247
176
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
248
177
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -255,7 +184,7 @@ describe "Mercury.modalHandlers.insertLink", ->
255
184
  $('input[value=new_bookmark]').prop('checked', true)
256
185
 
257
186
  it "triggers an action with the proper values", ->
258
- jasmine.simulate.click($('input[type=submit]').get(0))
187
+ jasmine.simulate.click($('#submit').get(0))
259
188
  expect(@triggerSpy.callCount).toEqual(1)
260
189
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
261
190
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
@@ -265,16 +194,14 @@ describe "Mercury.modalHandlers.insertLink", ->
265
194
 
266
195
  beforeEach ->
267
196
  @existingLink = $('<a>', {name: 'link3'}).html('foo')
268
- Mercury.region = selection: => {
269
- commonAncestor: => @existingLink
270
- }
271
- @insertLink.initialize()
197
+ Mercury.region = selection: => {commonAncestor: => @existingLink}
198
+ Mercury.modalHandlers.insertLink.call(@modal)
272
199
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
273
200
  $('#link_text').val('foo')
274
201
 
275
202
  it "hides the modal", ->
276
203
  spy = spyOn(@modal, 'hide').andCallFake(=>)
277
- jasmine.simulate.click($('input[type=submit]').get(0))
204
+ jasmine.simulate.click($('#submit').get(0))
278
205
  expect(spy.callCount).toEqual(1)
279
206
 
280
207
  describe "as a standard link", ->
@@ -285,7 +212,7 @@ describe "Mercury.modalHandlers.insertLink", ->
285
212
  $('input[value=external_url]').prop('checked', true)
286
213
 
287
214
  it "triggers an action with the proper values", ->
288
- jasmine.simulate.click($('input[type=submit]').get(0))
215
+ jasmine.simulate.click($('#submit').get(0))
289
216
  expect(@triggerSpy.callCount).toEqual(1)
290
217
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
291
218
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('replaceLink')
@@ -1,44 +1,43 @@
1
1
  describe "Mercury.modalHandlers.insertMedia", ->
2
2
 
3
+ template 'mercury/modals/insertmedia.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/modals/insertmedia.html')
5
6
  Mercury.region = null
6
- spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
7
+ spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
7
8
  @modal =
8
- element: $(fixture.el)
9
+ element: $('#test')
9
10
  hide: ->
10
11
  resize: ->
11
- @insertMedia = $.extend(@modal, Mercury.modalHandlers.insertMedia)
12
- window.mercuryInstance = {document: $(document)}
13
12
 
14
13
  describe "clicking on a radio button (in a label)", ->
15
14
 
16
15
  beforeEach ->
17
- @insertMedia.initialize()
16
+ Mercury.modalHandlers.insertMedia.call(@modal)
18
17
 
19
18
  it "focuses the next input with a selectable class", ->
20
19
  spy = spyOn($.fn, 'focus').andCallFake(=>)
21
- jasmine.simulate.click($('input[value=image_url]').get(0))
20
+ jasmine.simulate.click($('#checkbox1').get(0))
22
21
  expect(spy.callCount).toEqual(1)
23
22
 
24
23
 
25
24
  describe "focusing an input", ->
26
25
 
27
26
  beforeEach ->
28
- @insertMedia.initialize()
27
+ Mercury.modalHandlers.insertMedia.call(@modal)
29
28
 
30
29
  it "checks the corresponding checkbox", ->
31
30
  $('#media_youtube_url').focus()
32
- expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
31
+ expect($('#checkbox2').get(0).checked).toEqual(true)
33
32
 
34
33
  it "hides all the option divs", ->
35
34
  $('#media_youtube_url').focus()
36
- expect($('#image_url_options').css('display')).toEqual('none')
37
- expect($('#vimeo_url_options').css('display')).toEqual('none')
35
+ expect($('#image_url').css('display')).toEqual('none')
36
+ expect($('#vimeo_url').css('display')).toEqual('none')
38
37
 
39
38
  it "shows the options for the item that was focused", ->
40
39
  $('#media_youtube_url').focus()
41
- expect($('#youtube_url_options').css('display')).toNotEqual('none')
40
+ expect($('#youtube_url').css('display')).toNotEqual('none')
42
41
 
43
42
  it "calls resize", ->
44
43
  spy = spyOn(@modal, 'resize').andCallFake(=>)
@@ -52,33 +51,30 @@ describe "Mercury.modalHandlers.insertMedia", ->
52
51
 
53
52
  beforeEach ->
54
53
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
55
- @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right', style: 'float: left;'})}
54
+ @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
56
55
  Mercury.region = selection: => @selection
57
- @insertMedia.initialize()
56
+ Mercury.modalHandlers.insertMedia.call(@modal)
58
57
 
59
58
  it "pre-fills the image url", ->
60
59
  expect($('#media_image_url').val()).toEqual('/foo.gif')
61
60
 
62
61
  it "focuses the url input", ->
63
- expect(@focusSpy.callCount).toEqual(2)
62
+ expect(@focusSpy.callCount).toEqual(1)
64
63
  expect($('input[value=image_url]').get(0).checked).toEqual(true)
65
64
 
66
65
  it "sets the image alignment option", ->
67
66
  expect($('#media_image_alignment').val()).toEqual('right')
68
67
 
69
- it "sets the image float option", ->
70
- expect($('#media_image_float').val()).toEqual('left')
71
-
72
68
  describe "an existing youtube video", ->
73
69
 
74
70
  beforeEach ->
75
71
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
76
- @selection = {is: -> $('<iframe>', {src: 'https://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
72
+ @selection = {is: -> $('<iframe>', {src: 'http://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
77
73
  Mercury.region = selection: => @selection
78
- @insertMedia.initialize()
74
+ Mercury.modalHandlers.insertMedia.call(@modal)
79
75
 
80
76
  it "pre-fills the url", ->
81
- expect($('#media_youtube_url').val()).toEqual('https://youtu.be/foo')
77
+ expect($('#media_youtube_url').val()).toEqual('http://youtu.be/foo')
82
78
 
83
79
  it "focuses the url input", ->
84
80
  expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
@@ -95,7 +91,7 @@ describe "Mercury.modalHandlers.insertMedia", ->
95
91
  @focusSpy = spyOn($.fn, 'focus').andCallThrough()
96
92
  @selection = {is: -> $('<iframe>', {src: 'http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff', style: 'width:100px;height:42px'})}
97
93
  Mercury.region = selection: => @selection
98
- @insertMedia.initialize()
94
+ Mercury.modalHandlers.insertMedia.call(@modal)
99
95
 
100
96
  it "pre-fills the url", ->
101
97
  expect($('#media_vimeo_url').val()).toEqual('http://vimeo.com/foo')
@@ -110,67 +106,15 @@ describe "Mercury.modalHandlers.insertMedia", ->
110
106
  expect($('#media_vimeo_height').val()).toEqual('42')
111
107
 
112
108
 
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
-
158
109
  describe "submitting", ->
159
110
 
160
111
  beforeEach ->
161
- @insertMedia.initialize()
112
+ Mercury.modalHandlers.insertMedia.call(@modal)
162
113
  @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
163
114
 
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
-
170
115
  it "hides the modal", ->
171
- $('#media_image_url').val('foo.gif')
172
- spy = spyOn(@modal, 'hide')
173
- jasmine.simulate.click($('input[type=submit]').get(0))
116
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
117
+ jasmine.simulate.click($('#submit').get(0))
174
118
  expect(spy.callCount).toEqual(1)
175
119
 
176
120
  describe "an image", ->
@@ -178,14 +122,13 @@ describe "Mercury.modalHandlers.insertMedia", ->
178
122
  beforeEach ->
179
123
  $('#media_image_url').val('http://domain/foo.gif')
180
124
  $('#media_image_alignment').val('right')
181
- $('#media_image_float').val('left')
182
125
 
183
126
  it "triggers an action with the proper values", ->
184
- jasmine.simulate.click($('input[type=submit]').get(0))
127
+ jasmine.simulate.click($('#submit').get(0))
185
128
  expect(@triggerSpy.callCount).toEqual(1)
186
129
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
187
130
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertImage')
188
- expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right', style: 'float: left;'})
131
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right'})
189
132
 
190
133
  describe "a youtube video", ->
191
134
 
@@ -196,8 +139,7 @@ describe "Mercury.modalHandlers.insertMedia", ->
196
139
  $('input[value=youtube_url]').prop('checked', true)
197
140
 
198
141
  it "triggers an action with the proper values", ->
199
- $('#media_youtube_url').val('http://youtu.be/foo')
200
- jasmine.simulate.click($('input[type=submit]').get(0))
142
+ jasmine.simulate.click($('#submit').get(0))
201
143
  expect(@triggerSpy.callCount).toEqual(1)
202
144
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
203
145
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
@@ -206,27 +148,16 @@ describe "Mercury.modalHandlers.insertMedia", ->
206
148
  expect(value).toContain('42px')
207
149
  expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
208
150
 
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
-
220
151
  describe "a vimeo video", ->
221
152
 
222
153
  beforeEach ->
154
+ $('#media_vimeo_url').val('http://vimeo.com/foo')
223
155
  $('#media_vimeo_width').val(100)
224
156
  $('#media_vimeo_height').val('42')
225
157
  $('input[value=vimeo_url]').prop('checked', true)
226
158
 
227
159
  it "triggers an action with the proper values", ->
228
- $('#media_vimeo_url').val('http://vimeo.com/foo')
229
- jasmine.simulate.click($('input[type=submit]').get(0))
160
+ jasmine.simulate.click($('#submit').get(0))
230
161
  expect(@triggerSpy.callCount).toEqual(1)
231
162
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
232
163
  expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
@@ -234,14 +165,3 @@ describe "Mercury.modalHandlers.insertMedia", ->
234
165
  expect(value).toContain('100px')
235
166
  expect(value).toContain('42px')
236
167
  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')
@@ -1,13 +1,14 @@
1
1
  describe "Mercury.modalHandlers.insertSnippet", ->
2
2
 
3
+ template 'mercury/modals/insertsnippet.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/modals/insertsnippet.html')
5
6
  Mercury.Snippet.all = []
6
7
  Mercury.Snippet.load({
7
8
  'snippet_0': {name: 'foo', options: {'first_name': "Jeremy", 'last_name': "Jackson"}},
8
9
  })
9
10
  @modal =
10
- element: $(fixture.el)
11
+ element: $('#test')
11
12
  hide: ->
12
13
  options: {snippetName: 'test'}
13
14
  Mercury.modalHandlers.insertSnippet.call(@modal)