mercury-rails 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/app/assets/images/mercury/toolbar/{snippetable → snippets}/buttons.png +0 -0
  2. data/app/assets/javascripts/mercury.js +58 -84
  3. data/app/assets/javascripts/mercury/lightview.js.coffee +1 -1
  4. data/app/assets/javascripts/mercury/mercury.js.coffee +1 -1
  5. data/app/assets/javascripts/mercury/modal.js.coffee +1 -1
  6. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +13 -9
  7. data/app/assets/javascripts/mercury/native_extensions.js.coffee +0 -6
  8. data/app/assets/javascripts/mercury/page_editor.js.coffee +19 -19
  9. data/app/assets/javascripts/mercury/region.js.coffee +11 -10
  10. data/app/assets/javascripts/mercury/regions/{editable.js.coffee → full.coffee} +18 -18
  11. data/app/assets/javascripts/mercury/regions/image.js.coffee +13 -34
  12. data/app/assets/javascripts/mercury/regions/{markupable.js.coffee → markdown.coffee} +21 -22
  13. data/app/assets/javascripts/mercury/regions/simple.js.coffee +10 -39
  14. data/app/assets/javascripts/mercury/regions/{snippetable.js.coffee → snippets.js.coffee} +8 -7
  15. data/app/assets/javascripts/mercury/snippet.js.coffee +1 -1
  16. data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +3 -2
  17. data/app/assets/javascripts/mercury/toolbar.button.js.coffee +2 -2
  18. data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
  19. data/app/assets/javascripts/mercury/toolbar.js.coffee +2 -2
  20. data/app/assets/javascripts/mercury/uploader.js.coffee +2 -1
  21. data/app/assets/stylesheets/mercury/all_images.css.erb +2 -2
  22. data/app/assets/stylesheets/mercury/dialog.css +2 -2
  23. data/app/assets/stylesheets/mercury/lightview.css +14 -14
  24. data/app/assets/stylesheets/mercury/modal.css +1 -1
  25. data/app/assets/stylesheets/mercury/toolbar.css +1 -1
  26. data/features/generators/install.feature +1 -1
  27. data/features/loading/loading.feature +2 -2
  28. data/features/regions/{editable → full}/advanced_editing.feature +0 -0
  29. data/features/regions/full/basic_editing.feature +196 -0
  30. data/features/regions/{editable → full}/inserting_links.feature +12 -12
  31. data/features/regions/{editable → full}/inserting_media.feature +15 -15
  32. data/features/regions/{editable → full}/inserting_snippets.feature +15 -15
  33. data/features/regions/{editable → full}/inserting_special_characters.feature +2 -2
  34. data/features/regions/full/inserting_tables.feature +109 -0
  35. data/features/regions/{editable → full}/pasting.feature +0 -0
  36. data/features/regions/{editable → full}/uploading_images.feature +0 -0
  37. data/features/regions/{markupable → markdown}/advanced_editing.feature +0 -0
  38. data/features/regions/{markupable → markdown}/basic_editing.feature +0 -0
  39. data/features/regions/{markupable → markdown}/inserting_links.feature +0 -0
  40. data/features/regions/{markupable → markdown}/inserting_media.feature +0 -0
  41. data/features/regions/{markupable → markdown}/inserting_snippets.feature +0 -0
  42. data/features/regions/{markupable → markdown}/inserting_special_characters.feature +0 -0
  43. data/features/regions/{markupable → markdown}/inserting_tables.feature +0 -0
  44. data/features/regions/{markupable → markdown}/uploading_images.feature +0 -0
  45. data/features/regions/{snippetable → snippets}/advanced_editing.feature +0 -0
  46. data/features/regions/{snippetable → snippets}/basic_editing.feature +0 -0
  47. data/features/regions/{snippetable → snippets}/inserting_snippets.feature +0 -0
  48. data/features/saving/saving.feature +8 -8
  49. data/features/step_definitions/mercury_steps.rb +13 -13
  50. data/features/support/mercury_selectors.rb +3 -3
  51. data/lib/generators/mercury/install/images/images_generator.rb +3 -0
  52. data/lib/generators/mercury/install/install_generator.rb +5 -5
  53. data/lib/mercury/version.rb +1 -1
  54. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  55. data/spec/dummy/{public → app/assets/javascripts}/prototype.js +0 -0
  56. data/spec/dummy/app/assets/stylesheets/application.css.scss +110 -0
  57. data/spec/dummy/public/frame.html +1 -1
  58. data/spec/dummy/public/index.html +92 -216
  59. data/spec/javascripts/mercury/lightview_spec.js.coffee +1 -1
  60. data/spec/javascripts/mercury/modal_spec.js.coffee +1 -1
  61. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +41 -2
  62. data/spec/javascripts/mercury/page_editor_spec.js.coffee +19 -18
  63. data/spec/javascripts/mercury/region_spec.js.coffee +12 -14
  64. data/spec/javascripts/mercury/regions/{editable_spec.js.coffee → full_spec.js.coffee} +16 -16
  65. data/spec/javascripts/mercury/regions/image_spec.js.coffee +3 -3
  66. data/spec/javascripts/mercury/regions/{markupable_spec.js.coffee → markdown_spec.js.coffee} +18 -18
  67. data/spec/javascripts/mercury/regions/simple_spec.js.coffee +3 -3
  68. data/spec/javascripts/mercury/regions/{snippetable_spec.js.coffee → snippets_spec.js.coffee} +53 -53
  69. data/spec/javascripts/mercury/snippet_spec.js.coffee +1 -1
  70. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +2 -2
  71. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +5 -5
  72. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +6 -6
  73. data/spec/javascripts/mercury/toolbar_spec.js.coffee +4 -4
  74. data/spec/javascripts/mercury/uploader_spec.js.coffee +5 -5
  75. data/spec/javascripts/templates/mercury/page_editor.html +4 -4
  76. data/spec/javascripts/templates/mercury/region.html +1 -1
  77. data/spec/javascripts/templates/mercury/regions/full.html +1 -0
  78. data/spec/javascripts/templates/mercury/regions/image.html +1 -1
  79. data/spec/javascripts/templates/mercury/regions/markdown.html +1 -0
  80. data/spec/javascripts/templates/mercury/regions/simple.html +1 -3
  81. data/spec/javascripts/templates/mercury/regions/snippets.html +4 -0
  82. metadata +65 -75
  83. data/app/assets/javascripts/mercury_loader.js +0 -193
  84. data/app/assets/javascripts/mercury_overrides.js +0 -6
  85. data/app/assets/stylesheets/mercury_overrides.css +0 -17
  86. data/features/regions/editable/basic_editing.feature +0 -196
  87. data/features/regions/editable/inserting_tables.feature +0 -109
  88. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  89. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  90. data/spec/dummy/public/404.html +0 -26
  91. data/spec/dummy/public/422.html +0 -26
  92. data/spec/dummy/public/canvastest.html +0 -103
  93. data/spec/javascripts/templates/mercury/regions/editable.html +0 -3
  94. data/spec/javascripts/templates/mercury/regions/snippetable.html +0 -4
@@ -326,7 +326,7 @@ describe "Mercury.lightview", ->
326
326
  describe "on a preloaded view", ->
327
327
 
328
328
  beforeEach ->
329
- @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
329
+ @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
330
330
  Mercury.preloadedViews = {'/blank.html': 'this is the preloaded content'}
331
331
 
332
332
  afterEach ->
@@ -313,7 +313,7 @@ describe "Mercury.modal", ->
313
313
  describe "on a preloaded view", ->
314
314
 
315
315
  beforeEach ->
316
- @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
316
+ @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
317
317
  Mercury.preloadedViews = {'/blank.html': 'this is the preloaded content'}
318
318
 
319
319
  afterEach ->
@@ -4,7 +4,7 @@ describe "Mercury.modalHandlers.insertMedia", ->
4
4
 
5
5
  beforeEach ->
6
6
  Mercury.region = null
7
- spyOn(window, 'setTimeout').andCallFake((timeout, callback) => callback())
7
+ spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
8
8
  @modal =
9
9
  element: $('#test')
10
10
  hide: ->
@@ -133,12 +133,20 @@ describe "Mercury.modalHandlers.insertMedia", ->
133
133
  describe "a youtube video", ->
134
134
 
135
135
  beforeEach ->
136
- $('#media_youtube_url').val('http://youtu.be/foo')
137
136
  $('#media_youtube_width').val(100)
138
137
  $('#media_youtube_height').val('42')
139
138
  $('input[value=youtube_url]').prop('checked', true)
140
139
 
140
+ it "doesn't allow bogus urls", ->
141
+ $('#media_youtube_url').val('http://example.com')
142
+ lastAlert = ''
143
+ spy = spyOn(window, 'alert').andCallFake((msg) -> lastAlert = msg)
144
+ jasmine.simulate.click($('#submit').get(0))
145
+ expect(spy.callCount).toEqual(1)
146
+ expect(lastAlert).toEqual('Error: The provided youtube share url was invalid.')
147
+
141
148
  it "triggers an action with the proper values", ->
149
+ $('#media_youtube_url').val('http://youtu.be/foo')
142
150
  jasmine.simulate.click($('#submit').get(0))
143
151
  expect(@triggerSpy.callCount).toEqual(1)
144
152
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
@@ -148,6 +156,17 @@ describe "Mercury.modalHandlers.insertMedia", ->
148
156
  expect(value).toContain('42px')
149
157
  expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
150
158
 
159
+ it "triggers an action with the proper values using https", ->
160
+ $('#media_youtube_url').val('https://youtu.be/foo')
161
+ jasmine.simulate.click($('#submit').get(0))
162
+ expect(@triggerSpy.callCount).toEqual(1)
163
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
164
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
165
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
166
+ expect(value).toContain('100px')
167
+ expect(value).toContain('42px')
168
+ expect(value).toContain('src="https://www.youtube.com/embed/foo?wmode=transparent"')
169
+
151
170
  describe "a vimeo video", ->
152
171
 
153
172
  beforeEach ->
@@ -156,7 +175,16 @@ describe "Mercury.modalHandlers.insertMedia", ->
156
175
  $('#media_vimeo_height').val('42')
157
176
  $('input[value=vimeo_url]').prop('checked', true)
158
177
 
178
+ it "doesn't allow bogus urls", ->
179
+ $('#media_vimeo_url').val('http://example.com')
180
+ lastAlert = ''
181
+ spy = spyOn(window, 'alert').andCallFake((msg) -> lastAlert = msg)
182
+ jasmine.simulate.click($('#submit').get(0))
183
+ expect(spy.callCount).toEqual(1)
184
+ expect(lastAlert).toEqual('Error: The provided vimeo url was invalid.')
185
+
159
186
  it "triggers an action with the proper values", ->
187
+ $('#media_vimeo_url').val('http://vimeo.com/foo')
160
188
  jasmine.simulate.click($('#submit').get(0))
161
189
  expect(@triggerSpy.callCount).toEqual(1)
162
190
  expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
@@ -165,3 +193,14 @@ describe "Mercury.modalHandlers.insertMedia", ->
165
193
  expect(value).toContain('100px')
166
194
  expect(value).toContain('42px')
167
195
  expect(value).toContain('http://player.vimeo.com/video/foo?title=1&amp;byline=1&amp;portrait=0&amp;color=ffffff')
196
+
197
+ it "triggers an action with the proper values using https", ->
198
+ $('#media_vimeo_url').val('https://vimeo.com/foo')
199
+ jasmine.simulate.click($('#submit').get(0))
200
+ expect(@triggerSpy.callCount).toEqual(1)
201
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
202
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
203
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
204
+ expect(value).toContain('100px')
205
+ expect(value).toContain('42px')
206
+ expect(value).toContain('https://player.vimeo.com/video/foo?title=1&amp;byline=1&amp;portrait=0&amp;color=ffffff')
@@ -3,7 +3,7 @@ describe "Mercury.PageEditor", ->
3
3
  template 'mercury/page_editor.html'
4
4
 
5
5
  beforeEach ->
6
- Mercury.config.regions.className = 'custom-region-class'
6
+ Mercury.config.regions.attribute = 'custom-region-attribute'
7
7
  Date.prototype.getTime = -> 1234
8
8
 
9
9
  afterEach ->
@@ -173,11 +173,13 @@ describe "Mercury.PageEditor", ->
173
173
  expect(spy.argsForCall[0]).toEqual(['ready'])
174
174
 
175
175
  it "fires the ready event (jQuery.trigger)", ->
176
- spy = spyOn(jQuery.fn, 'trigger').andCallFake(=>)
176
+ mock = {trigger: ->}
177
+ @pageEditor.iframe.get(0).contentWindow.jQuery = -> mock
178
+ spy = spyOn(mock, 'trigger').andCallFake(=>)
177
179
  @finalizeInterfaceSpy.andCallFake(=>)
178
180
  @pageEditor.initializeFrame()
179
- expect(spy.callCount).toEqual(2)
180
- expect(spy.argsForCall[0]).toEqual(['mercury:ready', undefined])
181
+ expect(spy.callCount).toEqual(1)
182
+ expect(spy.argsForCall[0]).toEqual(['mercury:ready'])
181
183
 
182
184
  it "fires the ready event (Event.fire)", ->
183
185
  @finalizeInterfaceSpy.andCallFake(=>)
@@ -256,8 +258,8 @@ describe "Mercury.PageEditor", ->
256
258
  beforeEach ->
257
259
  @resizeSpy = spyOn(Mercury.PageEditor.prototype, 'resize').andCallFake(=>)
258
260
  Mercury.PageEditor.prototype.initializeFrame = ->
259
- Mercury.Regions.Editable = -> {region: true}
260
- Mercury.Regions.Editable.supported = true
261
+ Mercury.Regions.Full = -> {region: true}
262
+ Mercury.Regions.Full.supported = true
261
263
  @pageEditor = new Mercury.PageEditor('', {appendTo: $('#test')})
262
264
 
263
265
  it "instantiates the region and pushes it into the regions array", ->
@@ -271,7 +273,7 @@ describe "Mercury.PageEditor", ->
271
273
 
272
274
  it "throws an exception when the data-type isn't known", ->
273
275
  expect(=> @pageEditor.buildRegion($('#region4'))).toThrow('Region type is malformed, no data-type provided, or "Unknown" is unknown for the "region4" region.')
274
- $('#region4').attr('data-type', 'foo')
276
+ $('#region4').attr('custom-region-attribute', 'foo')
275
277
  expect(=> @pageEditor.buildRegion($('#region4'))).toThrow('Region type is malformed, no data-type provided, or "Foo" is unknown for the "region4" region.')
276
278
 
277
279
  it "doesn't re-instantiate the region if the element's already initialized", ->
@@ -282,16 +284,16 @@ describe "Mercury.PageEditor", ->
282
284
 
283
285
  it "calls togglePreview on the region if in preview mode", ->
284
286
  callCount = 0
285
- Mercury.Regions.Editable = -> {region: true, togglePreview: -> callCount += 1 }
286
- Mercury.Regions.Editable.supported = true
287
+ Mercury.Regions.Full = -> {region: true, togglePreview: -> callCount += 1 }
288
+ Mercury.Regions.Full.supported = true
287
289
  @pageEditor.previewing = true
288
290
  @pageEditor.buildRegion($('#region2'))
289
291
  expect(callCount).toEqual(1)
290
292
 
291
293
  it "doesn't call togglePreview if not in preview mode", ->
292
294
  callCount = 0
293
- Mercury.Regions.Editable = -> {region: true, togglePreview: -> callCount += 1 }
294
- Mercury.Regions.Editable.supported = true
295
+ Mercury.Regions.Full = -> {region: true, togglePreview: -> callCount += 1 }
296
+ Mercury.Regions.Full.supported = true
295
297
  @pageEditor.buildRegion($('#region2'))
296
298
  expect(callCount).toEqual(0)
297
299
 
@@ -319,7 +321,7 @@ describe "Mercury.PageEditor", ->
319
321
 
320
322
  it "fires a mode event to put things into preview mode if it's not visible yet", ->
321
323
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
322
- @pageEditor.options.visible = false
324
+ @pageEditor.visible = false
323
325
  @pageEditor.finalizeInterface()
324
326
  expect(spy.callCount).toEqual(1)
325
327
 
@@ -337,7 +339,7 @@ describe "Mercury.PageEditor", ->
337
339
 
338
340
  it "calls initializeFrame", ->
339
341
  @initializeFrameSpy = spyOn(Mercury.PageEditor.prototype, 'initializeFrame').andCallFake(=>)
340
- @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((timeout, callback) -> callback())
342
+ @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) -> callback())
341
343
  Mercury.trigger('initialize:frame')
342
344
  expect(@initializeFrameSpy.callCount).toEqual(1)
343
345
  expect(@setTimeoutSpy.callCount).toEqual(1)
@@ -355,7 +357,7 @@ describe "Mercury.PageEditor", ->
355
357
  it "calls focus on a focusable element", ->
356
358
  callCount = 0
357
359
  @pageEditor.focusableElement = {focus: -> callCount += 1}
358
- @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((timeout, callback) -> callback())
360
+ @setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) -> callback())
359
361
  Mercury.trigger('focus:window')
360
362
  expect(callCount).toEqual(1)
361
363
 
@@ -467,13 +469,12 @@ describe "Mercury.PageEditor", ->
467
469
  beforeEach ->
468
470
  @pageEditor.visible = true
469
471
 
470
- it "triggers an extra preview mode event if currently previewing", ->
471
- @pageEditor.previewing = true
472
+ it "triggers an preview mode event if not currently previewing", ->
473
+ @pageEditor.previewing = false
472
474
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
473
475
  @pageEditor.toggleInterface()
474
- expect(spy.callCount).toEqual(3)
476
+ expect(spy.callCount).toEqual(2)
475
477
  expect(spy.argsForCall[0]).toEqual(['mode', {mode: 'preview'}])
476
- expect(spy.argsForCall[1]).toEqual(['mode', {mode: 'preview'}])
477
478
 
478
479
  it "sets visible to false", ->
479
480
  @pageEditor.toggleInterface()
@@ -3,7 +3,7 @@ describe "Mercury.Region", ->
3
3
  template 'mercury/region.html'
4
4
 
5
5
  beforeEach ->
6
- Mercury.config.regions.className = 'custom-region-class'
6
+ Mercury.config.regions.attribute = 'custom-region-attribute'
7
7
  Mercury.config.regions.dataAttributes = []
8
8
 
9
9
  afterEach ->
@@ -127,17 +127,17 @@ describe "Mercury.Region", ->
127
127
 
128
128
  it "does nothing if in preview mode", ->
129
129
  @region.previewing = true
130
- jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
130
+ jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
131
131
  expect(@triggerSpy.callCount).toEqual(0)
132
132
 
133
133
  it "does nothing if it's not the active region", ->
134
134
  Mercury.region = {}
135
- jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
135
+ jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
136
136
  expect(@triggerSpy.callCount).toEqual(0)
137
137
 
138
138
  it "shows the snippet toolbar if a snippet was moused over", ->
139
139
  Mercury.region = @region
140
- jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
140
+ jasmine.simulate.mousemove($('#region_with_snippet .example-snippet').get(0))
141
141
  expect(@triggerSpy.callCount).toEqual(1)
142
142
  expect(@triggerSpy.argsForCall[0][0]).toEqual('show:toolbar')
143
143
 
@@ -166,11 +166,11 @@ describe "Mercury.Region", ->
166
166
 
167
167
  it "returns the html of the element", ->
168
168
  content = @region.content()
169
- expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1" data-version="1">snippet</div>')
169
+ expect(content).toEqual('contents<div class="example-snippet" data-snippet="snippet_1" data-version="1">snippet</div>')
170
170
 
171
171
  it "replaces snippet content with an indentifier if asked", ->
172
172
  content = @region.content(null, true)
173
- expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1">[snippet_1]</div>')
173
+ expect(content).toEqual('contents<div class="example-snippet" data-snippet="snippet_1">[snippet_1]</div>')
174
174
 
175
175
  describe "setting html", ->
176
176
 
@@ -195,9 +195,8 @@ describe "Mercury.Region", ->
195
195
  it "sets previewing to true", ->
196
196
  expect(@region.previewing).toEqual(true)
197
197
 
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)
198
+ it "removes the data attribute", ->
199
+ expect(@region.element.attr('custom-region-attribute')).toEqual(null)
201
200
 
202
201
  it "triggers a blur event", ->
203
202
  expect(@triggerSpy.callCount).toEqual(1)
@@ -212,9 +211,8 @@ describe "Mercury.Region", ->
212
211
  it "sets previewing to false", ->
213
212
  expect(@region.previewing).toEqual(false)
214
213
 
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)
214
+ it "adds the correct data attribute back", ->
215
+ expect(@region.element.attr('custom-region-attribute')).toEqual('unknown')
218
216
 
219
217
  it "calls focus if it's the active region", ->
220
218
  expect(@focusSpy.callCount).toEqual(1)
@@ -280,7 +278,7 @@ describe "Mercury.Region", ->
280
278
 
281
279
  it "returns an object with it's type, value, and snippets", ->
282
280
  serialized = @region.serialize()
283
- expect(serialized.type).toEqual('region')
281
+ expect(serialized.type).toEqual('unknown')
284
282
  expect(serialized.value).toEqual('contents')
285
283
  expect(serialized.snippets).toEqual({})
286
284
  expect(serialized.data).toEqual({})
@@ -292,7 +290,7 @@ describe "Mercury.Region", ->
292
290
 
293
291
  it "returns an object with it's type, value, data and snippets", ->
294
292
  serialized = @region.serialize()
295
- expect(serialized.type).toEqual('region')
293
+ expect(serialized.type).toEqual('unknown')
296
294
  expect(serialized.value).toEqual('contents')
297
295
  expect(serialized.snippets).toEqual({})
298
296
  expect(serialized.data).toEqual({scope: 'scope', version: '1'})
@@ -1,35 +1,35 @@
1
- describe "Mercury.Regions.Editable", ->
1
+ describe "Mercury.Regions.Full", ->
2
2
 
3
- template 'mercury/regions/editable.html'
3
+ template 'mercury/regions/full.html'
4
4
 
5
5
  beforeEach ->
6
- @regionElement = $('#editable_region1')
6
+ @regionElement = $('#full_region1')
7
7
 
8
8
  describe "constructor", ->
9
9
 
10
10
  beforeEach ->
11
- @buildSpy = spyOn(Mercury.Regions.Editable.prototype, 'build').andCallFake(=>)
12
- @bindEventsSpy = spyOn(Mercury.Regions.Editable.prototype, 'bindEvents').andCallFake(=>)
11
+ @buildSpy = spyOn(Mercury.Regions.Full.prototype, 'build').andCallFake(=>)
12
+ @bindEventsSpy = spyOn(Mercury.Regions.Full.prototype, 'bindEvents').andCallFake(=>)
13
13
 
14
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))
15
+ @region = new Mercury.Regions.Full(@regionElement, window)
16
+ expect(@region.element.get(0)).toEqual($('#full_region1').get(0))
17
17
  expect(@region.window).toEqual(window)
18
18
 
19
19
  it "accepts options", ->
20
- @region = new Mercury.Regions.Editable(@regionElement, window, {foo: 'something'})
20
+ @region = new Mercury.Regions.Full(@regionElement, window, {foo: 'something'})
21
21
  expect(@region.options).toEqual({foo: 'something'})
22
22
 
23
23
  it "sets it's type", ->
24
- @region = new Mercury.Regions.Editable(@regionElement, window)
25
- expect(@region.type).toEqual('editable')
24
+ @region = new Mercury.Regions.Full(@regionElement, window)
25
+ expect(@region.type()).toEqual('full')
26
26
 
27
27
  it "calls build", ->
28
- @region = new Mercury.Regions.Editable(@regionElement, window)
28
+ @region = new Mercury.Regions.Full(@regionElement, window)
29
29
  expect(@buildSpy.callCount).toEqual(1)
30
30
 
31
31
  it "calls bindEvents", ->
32
- @region = new Mercury.Regions.Editable(@regionElement, window)
32
+ @region = new Mercury.Regions.Full(@regionElement, window)
33
33
  expect(@bindEventsSpy.callCount).toEqual(1)
34
34
 
35
35
 
@@ -326,13 +326,13 @@ describe "Mercury.Regions.Editable", ->
326
326
 
327
327
 
328
328
 
329
- describe "Mercury.Regions.Editable.actions", ->
329
+ describe "Mercury.Regions.Full.actions", ->
330
330
 
331
- template 'mercury/regions/editable.html'
331
+ template 'mercury/regions/full.html'
332
332
 
333
333
  beforeEach ->
334
- #@region = new Mercury.Regions.Editable($('#editable_region1'), window)
335
- #@actions = Mercury.Regions.Editable.actions
334
+ #@region = new Mercury.Regions.Full($('#full_region1'), window)
335
+ #@actions = Mercury.Regions.Full.actions
336
336
 
337
337
  #
338
338
  # behaviors
@@ -3,7 +3,7 @@ describe "Mercury.Regions.Image", ->
3
3
  template 'mercury/regions/image.html'
4
4
 
5
5
  beforeEach ->
6
- @regionElement = $('#editable_region1')
6
+ @regionElement = $('#image_region1')
7
7
 
8
8
  describe "constructor", ->
9
9
 
@@ -13,7 +13,7 @@ describe "Mercury.Regions.Image", ->
13
13
 
14
14
  it "expects an element and window", ->
15
15
  @region = new Mercury.Regions.Image(@regionElement, window)
16
- expect(@region.element.get(0)).toEqual($('#editable_region1').get(0))
16
+ expect(@region.element.get(0)).toEqual($('#image_region1').get(0))
17
17
  expect(@region.window).toEqual(window)
18
18
 
19
19
  it "accepts options", ->
@@ -22,7 +22,7 @@ describe "Mercury.Regions.Image", ->
22
22
 
23
23
  it "sets it's type", ->
24
24
  @region = new Mercury.Regions.Image(@regionElement, window)
25
- expect(@region.type).toEqual('image')
25
+ expect(@region.type()).toEqual('image')
26
26
 
27
27
  it "calls build", ->
28
28
  @region = new Mercury.Regions.Image(@regionElement, window)
@@ -1,42 +1,42 @@
1
- describe "Mercury.Regions.Markupable", ->
1
+ describe "Mercury.Regions.Markdown", ->
2
2
 
3
- template 'mercury/regions/markupable.html'
3
+ template 'mercury/regions/markdown.html'
4
4
 
5
5
  beforeEach ->
6
- @regionElement = $('#markupable_region1')
6
+ @regionElement = $('#markdown_region1')
7
7
 
8
8
  describe "constructor", ->
9
9
 
10
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(=>)
11
+ @buildSpy = spyOn(Mercury.Regions.Markdown.prototype, 'build').andCallFake(=>)
12
+ @bindEventsSpy = spyOn(Mercury.Regions.Markdown.prototype, 'bindEvents').andCallFake(=>)
13
+ spyOn(Mercury.Regions.Markdown.prototype, 'pushHistory').andCallFake(=>)
14
14
 
15
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))
16
+ @region = new Mercury.Regions.Markdown(@regionElement, window)
17
+ expect(@region.element.get(0)).toEqual($('#markdown_region1').get(0))
18
18
  expect(@region.window).toEqual(window)
19
19
 
20
20
  it "accepts options", ->
21
- @region = new Mercury.Regions.Markupable(@regionElement, window, {foo: 'something'})
21
+ @region = new Mercury.Regions.Markdown(@regionElement, window, {foo: 'something'})
22
22
  expect(@region.options).toEqual({foo: 'something'})
23
23
 
24
24
  it "sets it's type", ->
25
- @region = new Mercury.Regions.Markupable(@regionElement, window)
26
- expect(@region.type).toEqual('markupable')
25
+ @region = new Mercury.Regions.Markdown(@regionElement, window)
26
+ expect(@region.type()).toEqual('markdown')
27
27
 
28
28
  it "creates a markdown converter using Showdown", ->
29
29
  spy = spyOn(Showdown, 'converter').andCallFake(=>)
30
- @region = new Mercury.Regions.Markupable(@regionElement, window)
30
+ @region = new Mercury.Regions.Markdown(@regionElement, window)
31
31
  expect(spy.callCount).toEqual(1)
32
32
  expect(@region.converter).toBeDefined()
33
33
 
34
34
  it "calls build", ->
35
- @region = new Mercury.Regions.Markupable(@regionElement, window)
35
+ @region = new Mercury.Regions.Markdown(@regionElement, window)
36
36
  expect(@buildSpy.callCount).toEqual(1)
37
37
 
38
38
  it "calls bindEvents", ->
39
- @region = new Mercury.Regions.Markupable(@regionElement, window)
39
+ @region = new Mercury.Regions.Markdown(@regionElement, window)
40
40
  expect(@bindEventsSpy.callCount).toEqual(1)
41
41
 
42
42
 
@@ -266,13 +266,13 @@ describe "Mercury.Regions.Markupable", ->
266
266
 
267
267
 
268
268
 
269
- describe "Mercury.Regions.Markupable.actions", ->
269
+ describe "Mercury.Regions.Markdown.actions", ->
270
270
 
271
- template 'mercury/regions/markupable.html'
271
+ template 'mercury/regions/markdown.html'
272
272
 
273
273
  beforeEach ->
274
- #@region = new Mercury.Regions.Markupable($('#markupable_region1'), window)
275
- #@actions = Mercury.Regions.Markupable.actions
274
+ #@region = new Mercury.Regions.Markdown($('#markdown_region1'), window)
275
+ #@actions = Mercury.Regions.Markdown.actions
276
276
 
277
277
  describe ".undo", ->
278
278