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,8 +1,9 @@
1
1
  describe "Mercury.Region", ->
2
2
 
3
+ template 'mercury/region.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/region.html')
5
- Mercury.config.regions.attribute = 'custom-region-attribute'
6
+ Mercury.config.regions.className = 'custom-region-class'
6
7
  Mercury.config.regions.dataAttributes = []
7
8
 
8
9
  afterEach ->
@@ -126,17 +127,17 @@ describe "Mercury.Region", ->
126
127
 
127
128
  it "does nothing if in preview mode", ->
128
129
  @region.previewing = true
129
- jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
130
+ jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
130
131
  expect(@triggerSpy.callCount).toEqual(0)
131
132
 
132
133
  it "does nothing if it's not the active region", ->
133
134
  Mercury.region = {}
134
- jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
135
+ jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
135
136
  expect(@triggerSpy.callCount).toEqual(0)
136
137
 
137
138
  it "shows the snippet toolbar if a snippet was moused over", ->
138
139
  Mercury.region = @region
139
- jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
140
+ jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
140
141
  expect(@triggerSpy.callCount).toEqual(1)
141
142
  expect(@triggerSpy.argsForCall[0][0]).toEqual('show:toolbar')
142
143
 
@@ -156,7 +157,7 @@ describe "Mercury.Region", ->
156
157
  expect(@triggerSpy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: false}])
157
158
 
158
159
 
159
- describe "#content", ->
160
+ describe "#html", ->
160
161
 
161
162
  beforeEach ->
162
163
  @region = new Mercury.Region($('#region_with_snippet'), window)
@@ -165,15 +166,11 @@ describe "Mercury.Region", ->
165
166
 
166
167
  it "returns the html of the element", ->
167
168
  content = @region.content()
168
- expect(content).toEqual('contents<div class="example-snippet" data-snippet="snippet_1" data-version="1">snippet</div>')
169
+ expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1" data-version="1">snippet</div>')
169
170
 
170
171
  it "replaces snippet content with an indentifier if asked", ->
171
172
  content = @region.content(null, true)
172
- expect(content).toEqual('contents<div class="example-snippet" data-snippet="snippet_1">[snippet_1]</div>')
173
-
174
- it "does not execute JavaScript contained within the region (bug fix)", ->
175
- (new Mercury.Region($('#region_with_javascript_snippet'), window)).content()
176
- expect($('#modifiable-element').children().length).toEqual(0)
173
+ expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1">[snippet_1]</div>')
177
174
 
178
175
  describe "setting html", ->
179
176
 
@@ -198,8 +195,9 @@ describe "Mercury.Region", ->
198
195
  it "sets previewing to true", ->
199
196
  expect(@region.previewing).toEqual(true)
200
197
 
201
- it "removes the data attribute", ->
202
- expect(@region.element.attr('custom-region-attribute')).toEqual(null)
198
+ it "swaps classes on the element", ->
199
+ expect(@region.element.hasClass('custom-region-class')).toEqual(false)
200
+ expect(@region.element.hasClass('custom-region-class-preview')).toEqual(true)
203
201
 
204
202
  it "triggers a blur event", ->
205
203
  expect(@triggerSpy.callCount).toEqual(1)
@@ -214,8 +212,9 @@ describe "Mercury.Region", ->
214
212
  it "sets previewing to false", ->
215
213
  expect(@region.previewing).toEqual(false)
216
214
 
217
- it "adds the correct data attribute back", ->
218
- expect(@region.element.attr('custom-region-attribute')).toEqual('unknown')
215
+ it "swaps classes on the element", ->
216
+ expect(@region.element.hasClass('custom-region-class-preview')).toEqual(false)
217
+ expect(@region.element.hasClass('custom-region-class')).toEqual(true)
219
218
 
220
219
  it "calls focus if it's the active region", ->
221
220
  expect(@focusSpy.callCount).toEqual(1)
@@ -271,10 +270,6 @@ describe "Mercury.Region", ->
271
270
  @region.element.attr('data-version', 2)
272
271
  expect(@region.dataAttributes()).toEqual({scope: 'scope', version: '2'})
273
272
 
274
- it "looks to @container if it's set", ->
275
- @region.container = $('<div>').attr('data-version', 3)
276
- expect(@region.dataAttributes()).toEqual({scope: undefined, version: '3'})
277
-
278
273
 
279
274
  describe "#serialize", ->
280
275
 
@@ -285,7 +280,7 @@ describe "Mercury.Region", ->
285
280
 
286
281
  it "returns an object with it's type, value, and snippets", ->
287
282
  serialized = @region.serialize()
288
- expect(serialized.type).toEqual('unknown')
283
+ expect(serialized.type).toEqual('region')
289
284
  expect(serialized.value).toEqual('contents')
290
285
  expect(serialized.snippets).toEqual({})
291
286
  expect(serialized.data).toEqual({})
@@ -297,7 +292,7 @@ describe "Mercury.Region", ->
297
292
 
298
293
  it "returns an object with it's type, value, data and snippets", ->
299
294
  serialized = @region.serialize()
300
- expect(serialized.type).toEqual('unknown')
295
+ expect(serialized.type).toEqual('region')
301
296
  expect(serialized.value).toEqual('contents')
302
297
  expect(serialized.snippets).toEqual({})
303
298
  expect(serialized.data).toEqual({scope: 'scope', version: '1'})
@@ -1,35 +1,36 @@
1
- describe "Mercury.Regions.Full", ->
1
+ describe "Mercury.Regions.Editable", ->
2
+
3
+ template 'mercury/regions/editable.html'
2
4
 
3
5
  beforeEach ->
4
- fixture.load('mercury/regions/full.html')
5
- @regionElement = $('#full_region1')
6
+ @regionElement = $('#editable_region1')
6
7
 
7
8
  describe "constructor", ->
8
9
 
9
- beforeEach ->
10
- @buildSpy = spyOn(Mercury.Regions.Full.prototype, 'build').andCallFake(=>)
11
- @bindEventsSpy = spyOn(Mercury.Regions.Full.prototype, 'bindEvents').andCallFake(=>)
10
+ beforeEach ->
11
+ @buildSpy = spyOn(Mercury.Regions.Editable.prototype, 'build').andCallFake(=>)
12
+ @bindEventsSpy = spyOn(Mercury.Regions.Editable.prototype, 'bindEvents').andCallFake(=>)
12
13
 
13
- it "expects an element and window", ->
14
- @region = new Mercury.Regions.Full(@regionElement, window)
15
- expect(@region.element.get(0)).toEqual($('#full_region1').get(0))
16
- expect(@region.window).toEqual(window)
14
+ it "expects an element and window", ->
15
+ @region = new Mercury.Regions.Editable(@regionElement, window)
16
+ expect(@region.element.get(0)).toEqual($('#editable_region1').get(0))
17
+ expect(@region.window).toEqual(window)
17
18
 
18
- it "accepts options", ->
19
- @region = new Mercury.Regions.Full(@regionElement, window, {foo: 'something'})
20
- expect(@region.options).toEqual({foo: 'something'})
19
+ it "accepts options", ->
20
+ @region = new Mercury.Regions.Editable(@regionElement, window, {foo: 'something'})
21
+ expect(@region.options).toEqual({foo: 'something'})
21
22
 
22
- it "sets it's type", ->
23
- @region = new Mercury.Regions.Full(@regionElement, window)
24
- expect(@region.type()).toEqual('full')
23
+ it "sets it's type", ->
24
+ @region = new Mercury.Regions.Editable(@regionElement, window)
25
+ expect(@region.type).toEqual('editable')
25
26
 
26
- it "calls build", ->
27
- @region = new Mercury.Regions.Full(@regionElement, window)
28
- expect(@buildSpy.callCount).toEqual(1)
27
+ it "calls build", ->
28
+ @region = new Mercury.Regions.Editable(@regionElement, window)
29
+ expect(@buildSpy.callCount).toEqual(1)
29
30
 
30
- it "calls bindEvents", ->
31
- @region = new Mercury.Regions.Full(@regionElement, window)
32
- expect(@bindEventsSpy.callCount).toEqual(1)
31
+ it "calls bindEvents", ->
32
+ @region = new Mercury.Regions.Editable(@regionElement, window)
33
+ expect(@bindEventsSpy.callCount).toEqual(1)
33
34
 
34
35
 
35
36
  describe "#build", ->
@@ -325,12 +326,13 @@ describe "Mercury.Regions.Full", ->
325
326
 
326
327
 
327
328
 
328
- describe "Mercury.Regions.Full.actions", ->
329
+ describe "Mercury.Regions.Editable.actions", ->
330
+
331
+ template 'mercury/regions/editable.html'
329
332
 
330
333
  beforeEach ->
331
- fixture.load('mercury/regions/full.html')
332
- #@region = new Mercury.Regions.Full($('#full_region1'), window)
333
- #@actions = Mercury.Regions.Full.actions
334
+ #@region = new Mercury.Regions.Editable($('#editable_region1'), window)
335
+ #@actions = Mercury.Regions.Editable.actions
334
336
 
335
337
  #
336
338
  # behaviors
@@ -1,42 +1,43 @@
1
- describe "Mercury.Regions.Markdown", ->
1
+ describe "Mercury.Regions.Markupable", ->
2
+
3
+ template 'mercury/regions/markupable.html'
2
4
 
3
5
  beforeEach ->
4
- fixture.load('mercury/regions/markdown.html')
5
- @regionElement = $('#markdown_region1')
6
+ @regionElement = $('#markupable_region1')
6
7
 
7
8
  describe "constructor", ->
8
9
 
9
- beforeEach ->
10
- @buildSpy = spyOn(Mercury.Regions.Markdown.prototype, 'build').andCallFake(=>)
11
- @bindEventsSpy = spyOn(Mercury.Regions.Markdown.prototype, 'bindEvents').andCallFake(=>)
12
- spyOn(Mercury.Regions.Markdown.prototype, 'pushHistory').andCallFake(=>)
10
+ beforeEach ->
11
+ @buildSpy = spyOn(Mercury.Regions.Markupable.prototype, 'build').andCallFake(=>)
12
+ @bindEventsSpy = spyOn(Mercury.Regions.Markupable.prototype, 'bindEvents').andCallFake(=>)
13
+ spyOn(Mercury.Regions.Markupable.prototype, 'pushHistory').andCallFake(=>)
13
14
 
14
- it "expects an element and window", ->
15
- @region = new Mercury.Regions.Markdown(@regionElement, window)
16
- expect(@region.element.get(0)).toEqual($('#markdown_region1').get(0))
17
- expect(@region.window).toEqual(window)
15
+ it "expects an element and window", ->
16
+ @region = new Mercury.Regions.Markupable(@regionElement, window)
17
+ expect(@region.element.get(0)).toEqual($('#markupable_region1').get(0))
18
+ expect(@region.window).toEqual(window)
18
19
 
19
- it "accepts options", ->
20
- @region = new Mercury.Regions.Markdown(@regionElement, window, {foo: 'something'})
21
- expect(@region.options).toEqual({foo: 'something'})
20
+ it "accepts options", ->
21
+ @region = new Mercury.Regions.Markupable(@regionElement, window, {foo: 'something'})
22
+ expect(@region.options).toEqual({foo: 'something'})
22
23
 
23
- it "sets it's type", ->
24
- @region = new Mercury.Regions.Markdown(@regionElement, window)
25
- expect(@region.type()).toEqual('markdown')
24
+ it "sets it's type", ->
25
+ @region = new Mercury.Regions.Markupable(@regionElement, window)
26
+ expect(@region.type).toEqual('markupable')
26
27
 
27
- it "creates a markdown converter using Showdown", ->
28
- spy = spyOn(Showdown, 'converter').andCallFake(=>)
29
- @region = new Mercury.Regions.Markdown(@regionElement, window)
30
- expect(spy.callCount).toEqual(1)
31
- expect(@region.converter).toBeDefined()
28
+ it "creates a markdown converter using Showdown", ->
29
+ spy = spyOn(Showdown, 'converter').andCallFake(=>)
30
+ @region = new Mercury.Regions.Markupable(@regionElement, window)
31
+ expect(spy.callCount).toEqual(1)
32
+ expect(@region.converter).toBeDefined()
32
33
 
33
- it "calls build", ->
34
- @region = new Mercury.Regions.Markdown(@regionElement, window)
35
- expect(@buildSpy.callCount).toEqual(1)
34
+ it "calls build", ->
35
+ @region = new Mercury.Regions.Markupable(@regionElement, window)
36
+ expect(@buildSpy.callCount).toEqual(1)
36
37
 
37
- it "calls bindEvents", ->
38
- @region = new Mercury.Regions.Markdown(@regionElement, window)
39
- expect(@bindEventsSpy.callCount).toEqual(1)
38
+ it "calls bindEvents", ->
39
+ @region = new Mercury.Regions.Markupable(@regionElement, window)
40
+ expect(@bindEventsSpy.callCount).toEqual(1)
40
41
 
41
42
 
42
43
  describe "#build", ->
@@ -265,12 +266,13 @@ describe "Mercury.Regions.Markdown", ->
265
266
 
266
267
 
267
268
 
268
- describe "Mercury.Regions.Markdown.actions", ->
269
+ describe "Mercury.Regions.Markupable.actions", ->
270
+
271
+ template 'mercury/regions/markupable.html'
269
272
 
270
273
  beforeEach ->
271
- fixture.load('mercury/regions/markdown.html')
272
- #@region = new Mercury.Regions.Markdown($('#markdown_region1'), window)
273
- #@actions = Mercury.Regions.Markdown.actions
274
+ #@region = new Mercury.Regions.Markupable($('#markupable_region1'), window)
275
+ #@actions = Mercury.Regions.Markupable.actions
274
276
 
275
277
  describe ".undo", ->
276
278
 
@@ -1,8 +1,9 @@
1
- describe "Mercury.Regions.Snippets", ->
1
+ describe "Mercury.Regions.Snippetable", ->
2
+
3
+ template 'mercury/regions/snippetable.html'
2
4
 
3
5
  beforeEach ->
4
- fixture.load('mercury/regions/snippets.html')
5
- @regionElement = $('#snippets_region1')
6
+ @regionElement = $('#snippetable_region1')
6
7
 
7
8
  afterEach ->
8
9
  @region = null
@@ -11,50 +12,50 @@ describe "Mercury.Regions.Snippets", ->
11
12
  describe "constructor", ->
12
13
 
13
14
  beforeEach ->
14
- @buildSpy = spyOn(Mercury.Regions.Snippets.prototype, 'build').andCallFake(=>)
15
- @bindEventsSpy = spyOn(Mercury.Regions.Snippets.prototype, 'bindEvents').andCallFake(=>)
16
- @makeSortableSpy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable').andCallFake(=>)
15
+ @buildSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'build').andCallFake(=>)
16
+ @bindEventsSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
17
+ @makeSortableSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable').andCallFake(=>)
17
18
 
18
19
  it "expects an element and window", ->
19
- @region = new Mercury.Regions.Snippets(@regionElement, window)
20
- expect(@region.element.get(0)).toEqual($('#snippets_region1').get(0))
20
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
21
+ expect(@region.element.get(0)).toEqual($('#snippetable_region1').get(0))
21
22
  expect(@region.window).toEqual(window)
22
23
 
23
24
  it "accepts options", ->
24
- @region = new Mercury.Regions.Snippets(@regionElement, window, {foo: 'something'})
25
+ @region = new Mercury.Regions.Snippetable(@regionElement, window, {foo: 'something'})
25
26
  expect(@region.options).toEqual({foo: 'something'})
26
27
 
27
28
  it "sets it's type", ->
28
- @region = new Mercury.Regions.Snippets(@regionElement, window)
29
- expect(@region.type()).toEqual('snippets')
29
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
30
+ expect(@region.type).toEqual('snippetable')
30
31
 
31
32
  it "calls build", ->
32
- @region = new Mercury.Regions.Snippets(@regionElement, window)
33
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
33
34
  expect(@buildSpy.callCount).toEqual(1)
34
35
 
35
36
  it "calls bindEvents", ->
36
- @region = new Mercury.Regions.Snippets(@regionElement, window)
37
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
37
38
  expect(@bindEventsSpy.callCount).toEqual(1)
38
39
 
39
40
  it "makes the snippets sortable", ->
40
- @region = new Mercury.Regions.Snippets(@regionElement, window)
41
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
41
42
  expect(@makeSortableSpy.callCount).toEqual(1)
42
43
 
43
44
 
44
45
  describe "#build", ->
45
46
 
46
47
  beforeEach ->
47
- spyOn(Mercury.Regions.Snippets.prototype, 'bindEvents').andCallFake(=>)
48
+ spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
48
49
 
49
50
  it "sets the element min-height to 20 if it's min-height is 0 (or not set)", ->
50
- @region = new Mercury.Regions.Snippets(@regionElement, window)
51
- expect($('#snippets_region1').css('minHeight')).toEqual('20px')
51
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
52
+ expect($('#snippetable_region1').css('minHeight')).toEqual('20px')
52
53
 
53
54
 
54
55
  describe "observed events", ->
55
56
 
56
57
  beforeEach ->
57
- @region = new Mercury.Regions.Snippets(@regionElement, window)
58
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
58
59
  Mercury.region = @region
59
60
 
60
61
  describe "custom event: unfocus:regions", ->
@@ -120,33 +121,33 @@ describe "Mercury.Regions.Snippets", ->
120
121
  describe "keydown on document (for undo / redo)", ->
121
122
 
122
123
  it "calls execCommand with undo on meta+z", ->
123
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
124
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
124
125
  jasmine.simulate.keydown(document, {shiftKey: false, metaKey: true, keyCode: 90})
125
126
  expect(spy.callCount).toEqual(1)
126
127
  expect(spy.argsForCall[0]).toEqual(['undo'])
127
128
 
128
129
  it "calls execCommand with redo on shift+meta+z", ->
129
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
130
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
130
131
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
131
132
  expect(spy.callCount).toEqual(1)
132
133
  expect(spy.argsForCall[0]).toEqual(['redo'])
133
134
 
134
135
  it "does nothing if previewing", ->
135
136
  @region.previewing = true
136
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
137
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
137
138
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
138
139
  expect(spy.callCount).toEqual(0)
139
140
 
140
141
  it "does nothing if it's not the active region", ->
141
142
  Mercury.region = null
142
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
143
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
143
144
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
144
145
  expect(spy.callCount).toEqual(0)
145
146
 
146
147
  describe "mouseup", ->
147
148
 
148
149
  it "calls focus", ->
149
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'focus')
150
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
150
151
  jasmine.simulate.mouseup(@region.element.get(0))
151
152
  expect(spy.callCount).toEqual(1)
152
153
 
@@ -157,7 +158,7 @@ describe "Mercury.Regions.Snippets", ->
157
158
 
158
159
  it "does nothing if previewing", ->
159
160
  @region.previewing = true
160
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'focus')
161
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
161
162
  jasmine.simulate.mouseup(@region.element.get(0))
162
163
  expect(spy.callCount).toEqual(0)
163
164
 
@@ -180,7 +181,7 @@ describe "Mercury.Regions.Snippets", ->
180
181
  describe "#focus", ->
181
182
 
182
183
  beforeEach ->
183
- @region = new Mercury.Regions.Snippets(@regionElement, window)
184
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
184
185
 
185
186
  it "sets the active mercury region", ->
186
187
  Mercury.region = null
@@ -188,19 +189,19 @@ describe "Mercury.Regions.Snippets", ->
188
189
  expect(Mercury.region).toEqual(@region)
189
190
 
190
191
  it "makes the snippets sortable again", ->
191
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable')
192
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
192
193
  @region.focus()
193
194
  expect(spy.callCount).toEqual(1)
194
195
 
195
196
  it "adds the focus class to the element", ->
196
197
  @region.focus()
197
- expect($('#snippets_region1').hasClass('focus')).toEqual(true)
198
+ expect($('#snippetable_region1').hasClass('focus')).toEqual(true)
198
199
 
199
200
 
200
201
  describe "#togglePreview", ->
201
202
 
202
203
  beforeEach ->
203
- @region = new Mercury.Regions.Snippets(@regionElement, window)
204
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
204
205
 
205
206
  describe "when not previewing", ->
206
207
 
@@ -213,7 +214,7 @@ describe "Mercury.Regions.Snippets", ->
213
214
  it "removes the focus class", ->
214
215
  @regionElement.addClass('focus')
215
216
  @region.togglePreview()
216
- expect($('#snippets_region1').hasClass('focus')).toEqual(false)
217
+ expect($('#snippetable_region1').hasClass('focus')).toEqual(false)
217
218
 
218
219
  describe "when previewing", ->
219
220
 
@@ -221,7 +222,7 @@ describe "Mercury.Regions.Snippets", ->
221
222
  @region.previewing = true
222
223
 
223
224
  it "makes the snippets sortable again", ->
224
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable')
225
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
225
226
  @region.togglePreview()
226
227
  expect(spy.callCount).toEqual(1)
227
228
 
@@ -229,9 +230,9 @@ describe "Mercury.Regions.Snippets", ->
229
230
  describe "#execCommand", ->
230
231
 
231
232
  beforeEach ->
232
- @region = new Mercury.Regions.Snippets(@regionElement, window)
233
- Mercury.Regions.Snippets.actions['foo'] = ->
234
- @handlerSpy = spyOn(Mercury.Regions.Snippets.actions, 'foo')
233
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
234
+ Mercury.Regions.Snippetable.actions['foo'] = ->
235
+ @handlerSpy = spyOn(Mercury.Regions.Snippetable.actions, 'foo')
235
236
 
236
237
  it "calls a handler (from the actions) if one exists", ->
237
238
  @region.execCommand('foo', {value: 'something'})
@@ -242,7 +243,7 @@ describe "Mercury.Regions.Snippets", ->
242
243
  describe "#makeSortable", ->
243
244
 
244
245
  beforeEach ->
245
- @region = new Mercury.Regions.Snippets(@regionElement, window)
246
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
246
247
  @sortableSpy = spyOn($.fn, 'sortable')
247
248
 
248
249
  it "makes the snippets sortable", ->
@@ -260,25 +261,26 @@ describe "Mercury.Regions.Snippets", ->
260
261
  expect(spy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: true}])
261
262
 
262
263
  it "pushes to the history after dragging", ->
263
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
264
- spyOn(window, 'setTimeout').andCallFake((callback, timeout)=> callback())
264
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
265
+ spyOn(window, 'setTimeout').andCallFake((timeout, callback)=> callback())
265
266
  @sortableSpy.andCallFake((arg) => if arg == 'destroy' then return @region.element else arg.stop())
266
267
  @region.makeSortable()
267
268
  expect(spy.callCount).toEqual(1)
268
269
 
269
270
 
270
271
 
271
- describe "Mercury.Regions.Snippets.actions", ->
272
+ describe "Mercury.Regions.Snippetable.actions", ->
273
+
274
+ template 'mercury/regions/snippetable.html'
272
275
 
273
276
  beforeEach ->
274
- fixture.load('mercury/regions/snippets.html')
275
- @region = new Mercury.Regions.Snippets($('#snippets_region2'), window)
276
- @actions = Mercury.Regions.Snippets.actions
277
+ @region = new Mercury.Regions.Snippetable($('#snippetable_region2'), window)
278
+ @actions = Mercury.Regions.Snippetable.actions
277
279
 
278
280
  describe ".undo", ->
279
281
 
280
282
  it "calls undo on the history buffer and sets the content", ->
281
- htmlSpy = spyOn(Mercury.Regions.Snippets.prototype, 'content').andCallFake(=>)
283
+ htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
282
284
  historySpy = spyOn(@region.history, 'undo').andCallFake(=> 'history -1')
283
285
  @actions['undo'].call(@region)
284
286
  expect(historySpy.callCount).toEqual(1)
@@ -289,7 +291,7 @@ describe "Mercury.Regions.Snippets.actions", ->
289
291
  describe ".redo", ->
290
292
 
291
293
  it "calls redo on the history buffer and sets the content", ->
292
- htmlSpy = spyOn(Mercury.Regions.Snippets.prototype, 'content').andCallFake(=>)
294
+ htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
293
295
  historySpy = spyOn(@region.history, 'redo').andCallFake(=> 'history +1')
294
296
  @actions['redo'].call(@region)
295
297
  expect(historySpy.callCount).toEqual(1)
@@ -300,7 +302,6 @@ describe "Mercury.Regions.Snippets.actions", ->
300
302
  describe ".insertSnippet", ->
301
303
 
302
304
  beforeEach ->
303
- Mercury.Snippet.all = []
304
305
  Mercury.Snippet.load({
305
306
  'snippet_1': {name: 'example', options: {'foo': 'bar'}},
306
307
  'snippet_2': {name: 'example', options: {'foo': 'bar'}},
@@ -311,15 +312,15 @@ describe "Mercury.Regions.Snippets.actions", ->
311
312
 
312
313
  it "finds the snippet by it's identity and replaces it with the new snippet", ->
313
314
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
314
- expect($('#snippets_region2').html()).toContain('class="example-snippet"')
315
- expect($('#snippets_region2').html()).toContain('contenteditable="false"')
316
- expect($('#snippets_region2').html()).toContain('data-version="1"')
317
- expect($('#snippets_region2').html()).toContain('data-snippet="snippet_1"')
318
- expect($('#snippets_region2').html()).toContain('[snippet_1]')
315
+ expect($('#snippetable_region2').html()).toContain('class="mercury-snippet"')
316
+ expect($('#snippetable_region2').html()).toContain('contenteditable="false"')
317
+ expect($('#snippetable_region2').html()).toContain('data-version="1"')
318
+ expect($('#snippetable_region2').html()).toContain('data-snippet="snippet_1"')
319
+ expect($('#snippetable_region2').html()).toContain('[snippet_1]')
319
320
 
320
321
  it "pushes to the history after it's been rendered", ->
321
322
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
322
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
323
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
323
324
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
324
325
  expect(spy.callCount).toEqual(1)
325
326
 
@@ -327,11 +328,11 @@ describe "Mercury.Regions.Snippets.actions", ->
327
328
 
328
329
  it "appends the new snippet html to the element", ->
329
330
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
330
- expect($('#snippets_region2 [data-snippet]').length).toEqual(2)
331
+ expect($('#snippetable_region2 .mercury-snippet').length).toEqual(2)
331
332
 
332
333
  it "pushes to the history after it's been rendered", ->
333
334
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
334
- spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
335
+ spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
335
336
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
336
337
  expect(spy.callCount).toEqual(1)
337
338
 
@@ -339,7 +340,7 @@ describe "Mercury.Regions.Snippets.actions", ->
339
340
  describe ".editSnippet", ->
340
341
 
341
342
  beforeEach ->
342
- @region.snippet = $('#snippets_region2 [data-snippet]')
343
+ @region.snippet = $('#snippetable_region2 .mercury-snippet')
343
344
 
344
345
  it "finds and displays the options for the given snippet", ->
345
346
  spy = spyOn(Mercury.Snippet.prototype, 'displayOptions')
@@ -356,11 +357,11 @@ describe "Mercury.Regions.Snippets.actions", ->
356
357
  describe ".removeSnippet", ->
357
358
 
358
359
  beforeEach ->
359
- @region.snippet = $('#snippets_region2 .mercury-snippet')
360
+ @region.snippet = $('#snippetable_region2 .mercury-snippet')
360
361
 
361
362
  it "removes the snippet if there's an active one", ->
362
363
  @actions['removeSnippet'].call(@region)
363
- expect($('#snippets_region2 .mercury-snippet').length).toEqual(0)
364
+ expect($('#snippetable_region2 .mercury-snippet').length).toEqual(0)
364
365
 
365
366
  it "triggers the hide:toolbar event", ->
366
367
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
@@ -1,7 +1,8 @@
1
1
  describe "Mercury.Select", ->
2
2
 
3
+ template 'mercury/select.html'
4
+
3
5
  beforeEach ->
4
- fixture.load('mercury/select.html')
5
6
  $.fx.off = true
6
7
 
7
8
  afterEach ->
@@ -11,7 +12,7 @@ describe "Mercury.Select", ->
11
12
  describe "#build", ->
12
13
 
13
14
  it "builds an element", ->
14
- @select = new Mercury.Select('/blank.html', 'foo', {appendTo: fixture.el, for: $('#button')})
15
+ @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
15
16
  html = $('<div>').html(@select.element).html()
16
17
  expect(html).toContain('class="mercury-select mercury-foo-select loading"')
17
18
  expect(html).toContain('style="display:none"')
@@ -24,7 +25,7 @@ describe "Mercury.Select", ->
24
25
  describe "observed events", ->
25
26
 
26
27
  beforeEach ->
27
- @select = new Mercury.Select('/blank.html', 'foo', {appendTo: fixture.el, for: $('#button')})
28
+ @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
28
29
 
29
30
  it "hides", ->
30
31
  @select.element.css({display: 'block'})
@@ -40,7 +41,7 @@ describe "Mercury.Select", ->
40
41
  describe "#position", ->
41
42
 
42
43
  beforeEach ->
43
- @select = new Mercury.Select('/blank.html', 'foo', {appendTo: fixture.el, for: $('#button')})
44
+ @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
44
45
 
45
46
  it "positions based on it's button", ->
46
47
  @select.element.css({display: 'block'})