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
@@ -3,7 +3,7 @@ describe "Mercury.Regions.Simple", ->
3
3
  template 'mercury/regions/simple.html'
4
4
 
5
5
  beforeEach ->
6
- @regionElement = $('#editable_region1')
6
+ @regionElement = $('#simple_region1')
7
7
 
8
8
  describe "constructor", ->
9
9
 
@@ -13,7 +13,7 @@ describe "Mercury.Regions.Simple", ->
13
13
 
14
14
  it "expects an element and window", ->
15
15
  @region = new Mercury.Regions.Simple(@regionElement, window)
16
- expect(@region.element.get(0)).toEqual($('#editable_region1').get(0))
16
+ expect(@region.element.get(0)).toEqual($('#simple_region1').get(0))
17
17
  expect(@region.window).toEqual(window)
18
18
 
19
19
  it "accepts options", ->
@@ -22,7 +22,7 @@ describe "Mercury.Regions.Simple", ->
22
22
 
23
23
  it "sets it's type", ->
24
24
  @region = new Mercury.Regions.Simple(@regionElement, window)
25
- expect(@region.type).toEqual('simple')
25
+ expect(@region.type()).toEqual('simple')
26
26
 
27
27
  it "calls build", ->
28
28
  @region = new Mercury.Regions.Simple(@regionElement, window)
@@ -1,9 +1,9 @@
1
- describe "Mercury.Regions.Snippetable", ->
1
+ describe "Mercury.Regions.Snippets", ->
2
2
 
3
- template 'mercury/regions/snippetable.html'
3
+ template 'mercury/regions/snippets.html'
4
4
 
5
5
  beforeEach ->
6
- @regionElement = $('#snippetable_region1')
6
+ @regionElement = $('#snippets_region1')
7
7
 
8
8
  afterEach ->
9
9
  @region = null
@@ -12,50 +12,50 @@ describe "Mercury.Regions.Snippetable", ->
12
12
  describe "constructor", ->
13
13
 
14
14
  beforeEach ->
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(=>)
15
+ @buildSpy = spyOn(Mercury.Regions.Snippets.prototype, 'build').andCallFake(=>)
16
+ @bindEventsSpy = spyOn(Mercury.Regions.Snippets.prototype, 'bindEvents').andCallFake(=>)
17
+ @makeSortableSpy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable').andCallFake(=>)
18
18
 
19
19
  it "expects an element and window", ->
20
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
21
- expect(@region.element.get(0)).toEqual($('#snippetable_region1').get(0))
20
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
21
+ expect(@region.element.get(0)).toEqual($('#snippets_region1').get(0))
22
22
  expect(@region.window).toEqual(window)
23
23
 
24
24
  it "accepts options", ->
25
- @region = new Mercury.Regions.Snippetable(@regionElement, window, {foo: 'something'})
25
+ @region = new Mercury.Regions.Snippets(@regionElement, window, {foo: 'something'})
26
26
  expect(@region.options).toEqual({foo: 'something'})
27
27
 
28
28
  it "sets it's type", ->
29
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
30
- expect(@region.type).toEqual('snippetable')
29
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
30
+ expect(@region.type()).toEqual('snippets')
31
31
 
32
32
  it "calls build", ->
33
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
33
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
34
34
  expect(@buildSpy.callCount).toEqual(1)
35
35
 
36
36
  it "calls bindEvents", ->
37
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
37
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
38
38
  expect(@bindEventsSpy.callCount).toEqual(1)
39
39
 
40
40
  it "makes the snippets sortable", ->
41
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
41
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
42
42
  expect(@makeSortableSpy.callCount).toEqual(1)
43
43
 
44
44
 
45
45
  describe "#build", ->
46
46
 
47
47
  beforeEach ->
48
- spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
48
+ spyOn(Mercury.Regions.Snippets.prototype, 'bindEvents').andCallFake(=>)
49
49
 
50
50
  it "sets the element min-height to 20 if it's min-height is 0 (or not set)", ->
51
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
52
- expect($('#snippetable_region1').css('minHeight')).toEqual('20px')
51
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
52
+ expect($('#snippets_region1').css('minHeight')).toEqual('20px')
53
53
 
54
54
 
55
55
  describe "observed events", ->
56
56
 
57
57
  beforeEach ->
58
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
58
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
59
59
  Mercury.region = @region
60
60
 
61
61
  describe "custom event: unfocus:regions", ->
@@ -121,33 +121,33 @@ describe "Mercury.Regions.Snippetable", ->
121
121
  describe "keydown on document (for undo / redo)", ->
122
122
 
123
123
  it "calls execCommand with undo on meta+z", ->
124
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
124
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
125
125
  jasmine.simulate.keydown(document, {shiftKey: false, metaKey: true, keyCode: 90})
126
126
  expect(spy.callCount).toEqual(1)
127
127
  expect(spy.argsForCall[0]).toEqual(['undo'])
128
128
 
129
129
  it "calls execCommand with redo on shift+meta+z", ->
130
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
130
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
131
131
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
132
132
  expect(spy.callCount).toEqual(1)
133
133
  expect(spy.argsForCall[0]).toEqual(['redo'])
134
134
 
135
135
  it "does nothing if previewing", ->
136
136
  @region.previewing = true
137
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
137
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
138
138
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
139
139
  expect(spy.callCount).toEqual(0)
140
140
 
141
141
  it "does nothing if it's not the active region", ->
142
142
  Mercury.region = null
143
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
143
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'execCommand')
144
144
  jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
145
145
  expect(spy.callCount).toEqual(0)
146
146
 
147
147
  describe "mouseup", ->
148
148
 
149
149
  it "calls focus", ->
150
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
150
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'focus')
151
151
  jasmine.simulate.mouseup(@region.element.get(0))
152
152
  expect(spy.callCount).toEqual(1)
153
153
 
@@ -158,7 +158,7 @@ describe "Mercury.Regions.Snippetable", ->
158
158
 
159
159
  it "does nothing if previewing", ->
160
160
  @region.previewing = true
161
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
161
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'focus')
162
162
  jasmine.simulate.mouseup(@region.element.get(0))
163
163
  expect(spy.callCount).toEqual(0)
164
164
 
@@ -181,7 +181,7 @@ describe "Mercury.Regions.Snippetable", ->
181
181
  describe "#focus", ->
182
182
 
183
183
  beforeEach ->
184
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
184
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
185
185
 
186
186
  it "sets the active mercury region", ->
187
187
  Mercury.region = null
@@ -189,19 +189,19 @@ describe "Mercury.Regions.Snippetable", ->
189
189
  expect(Mercury.region).toEqual(@region)
190
190
 
191
191
  it "makes the snippets sortable again", ->
192
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
192
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable')
193
193
  @region.focus()
194
194
  expect(spy.callCount).toEqual(1)
195
195
 
196
196
  it "adds the focus class to the element", ->
197
197
  @region.focus()
198
- expect($('#snippetable_region1').hasClass('focus')).toEqual(true)
198
+ expect($('#snippets_region1').hasClass('focus')).toEqual(true)
199
199
 
200
200
 
201
201
  describe "#togglePreview", ->
202
202
 
203
203
  beforeEach ->
204
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
204
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
205
205
 
206
206
  describe "when not previewing", ->
207
207
 
@@ -214,7 +214,7 @@ describe "Mercury.Regions.Snippetable", ->
214
214
  it "removes the focus class", ->
215
215
  @regionElement.addClass('focus')
216
216
  @region.togglePreview()
217
- expect($('#snippetable_region1').hasClass('focus')).toEqual(false)
217
+ expect($('#snippets_region1').hasClass('focus')).toEqual(false)
218
218
 
219
219
  describe "when previewing", ->
220
220
 
@@ -222,7 +222,7 @@ describe "Mercury.Regions.Snippetable", ->
222
222
  @region.previewing = true
223
223
 
224
224
  it "makes the snippets sortable again", ->
225
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
225
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'makeSortable')
226
226
  @region.togglePreview()
227
227
  expect(spy.callCount).toEqual(1)
228
228
 
@@ -230,9 +230,9 @@ describe "Mercury.Regions.Snippetable", ->
230
230
  describe "#execCommand", ->
231
231
 
232
232
  beforeEach ->
233
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
234
- Mercury.Regions.Snippetable.actions['foo'] = ->
235
- @handlerSpy = spyOn(Mercury.Regions.Snippetable.actions, 'foo')
233
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
234
+ Mercury.Regions.Snippets.actions['foo'] = ->
235
+ @handlerSpy = spyOn(Mercury.Regions.Snippets.actions, 'foo')
236
236
 
237
237
  it "calls a handler (from the actions) if one exists", ->
238
238
  @region.execCommand('foo', {value: 'something'})
@@ -243,7 +243,7 @@ describe "Mercury.Regions.Snippetable", ->
243
243
  describe "#makeSortable", ->
244
244
 
245
245
  beforeEach ->
246
- @region = new Mercury.Regions.Snippetable(@regionElement, window)
246
+ @region = new Mercury.Regions.Snippets(@regionElement, window)
247
247
  @sortableSpy = spyOn($.fn, 'sortable')
248
248
 
249
249
  it "makes the snippets sortable", ->
@@ -261,26 +261,26 @@ describe "Mercury.Regions.Snippetable", ->
261
261
  expect(spy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: true}])
262
262
 
263
263
  it "pushes to the history after dragging", ->
264
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
265
- spyOn(window, 'setTimeout').andCallFake((timeout, callback)=> callback())
264
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
265
+ spyOn(window, 'setTimeout').andCallFake((callback, timeout)=> callback())
266
266
  @sortableSpy.andCallFake((arg) => if arg == 'destroy' then return @region.element else arg.stop())
267
267
  @region.makeSortable()
268
268
  expect(spy.callCount).toEqual(1)
269
269
 
270
270
 
271
271
 
272
- describe "Mercury.Regions.Snippetable.actions", ->
272
+ describe "Mercury.Regions.Snippets.actions", ->
273
273
 
274
- template 'mercury/regions/snippetable.html'
274
+ template 'mercury/regions/snippets.html'
275
275
 
276
276
  beforeEach ->
277
- @region = new Mercury.Regions.Snippetable($('#snippetable_region2'), window)
278
- @actions = Mercury.Regions.Snippetable.actions
277
+ @region = new Mercury.Regions.Snippets($('#snippets_region2'), window)
278
+ @actions = Mercury.Regions.Snippets.actions
279
279
 
280
280
  describe ".undo", ->
281
281
 
282
282
  it "calls undo on the history buffer and sets the content", ->
283
- htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
283
+ htmlSpy = spyOn(Mercury.Regions.Snippets.prototype, 'content').andCallFake(=>)
284
284
  historySpy = spyOn(@region.history, 'undo').andCallFake(=> 'history -1')
285
285
  @actions['undo'].call(@region)
286
286
  expect(historySpy.callCount).toEqual(1)
@@ -291,7 +291,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
291
291
  describe ".redo", ->
292
292
 
293
293
  it "calls redo on the history buffer and sets the content", ->
294
- htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
294
+ htmlSpy = spyOn(Mercury.Regions.Snippets.prototype, 'content').andCallFake(=>)
295
295
  historySpy = spyOn(@region.history, 'redo').andCallFake(=> 'history +1')
296
296
  @actions['redo'].call(@region)
297
297
  expect(historySpy.callCount).toEqual(1)
@@ -312,15 +312,15 @@ describe "Mercury.Regions.Snippetable.actions", ->
312
312
 
313
313
  it "finds the snippet by it's identity and replaces it with the new snippet", ->
314
314
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
315
- expect($('#snippetable_region2').html()).toContain('class="mercury-snippet example-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]')
315
+ expect($('#snippets_region2').html()).toContain('class="example-snippet"')
316
+ expect($('#snippets_region2').html()).toContain('contenteditable="false"')
317
+ expect($('#snippets_region2').html()).toContain('data-version="1"')
318
+ expect($('#snippets_region2').html()).toContain('data-snippet="snippet_1"')
319
+ expect($('#snippets_region2').html()).toContain('[snippet_1]')
320
320
 
321
321
  it "pushes to the history after it's been rendered", ->
322
322
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
323
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
323
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
324
324
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
325
325
  expect(spy.callCount).toEqual(1)
326
326
 
@@ -328,11 +328,11 @@ describe "Mercury.Regions.Snippetable.actions", ->
328
328
 
329
329
  it "appends the new snippet html to the element", ->
330
330
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
331
- expect($('#snippetable_region2 .mercury-snippet').length).toEqual(2)
331
+ expect($('#snippets_region2 [data-snippet]').length).toEqual(2)
332
332
 
333
333
  it "pushes to the history after it's been rendered", ->
334
334
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
335
- spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
335
+ spy = spyOn(Mercury.Regions.Snippets.prototype, 'pushHistory').andCallFake(=>)
336
336
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
337
337
  expect(spy.callCount).toEqual(1)
338
338
 
@@ -340,7 +340,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
340
340
  describe ".editSnippet", ->
341
341
 
342
342
  beforeEach ->
343
- @region.snippet = $('#snippetable_region2 .mercury-snippet')
343
+ @region.snippet = $('#snippets_region2 [data-snippet]')
344
344
 
345
345
  it "finds and displays the options for the given snippet", ->
346
346
  spy = spyOn(Mercury.Snippet.prototype, 'displayOptions')
@@ -357,11 +357,11 @@ describe "Mercury.Regions.Snippetable.actions", ->
357
357
  describe ".removeSnippet", ->
358
358
 
359
359
  beforeEach ->
360
- @region.snippet = $('#snippetable_region2 .mercury-snippet')
360
+ @region.snippet = $('#snippets_region2 .mercury-snippet')
361
361
 
362
362
  it "removes the snippet if there's an active one", ->
363
363
  @actions['removeSnippet'].call(@region)
364
- expect($('#snippetable_region2 .mercury-snippet').length).toEqual(0)
364
+ expect($('#snippets_region2 .mercury-snippet').length).toEqual(0)
365
365
 
366
366
  it "triggers the hide:toolbar event", ->
367
367
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
@@ -35,7 +35,7 @@ describe "Mercury.Snippet", ->
35
35
  it "builds an element (in whatever context is provided", ->
36
36
  ret = @snippet.getHTML($(document))
37
37
  html = $('<div>').html(ret).html()
38
- expect(html).toContain('class="mercury-snippet foo-snippet"')
38
+ expect(html).toContain('class="foo-snippet"')
39
39
  expect(html).toContain('contenteditable="false"')
40
40
  expect(html).toContain('data-snippet="identity"')
41
41
  expect(html).toContain('data-version="1"')
@@ -189,12 +189,12 @@ describe "Mercury.SnippetToolbar", ->
189
189
  expect(@setTimeoutSpy.callCount).toEqual(1)
190
190
 
191
191
  it "hides the element", ->
192
- @setTimeoutSpy.andCallFake((timeout, callback) => callback())
192
+ @setTimeoutSpy.andCallFake((callback, timeout) => callback())
193
193
  @snippetToolbar.hide()
194
194
  expect(@snippetToolbar.element.css('display')).toEqual('none')
195
195
 
196
196
  it "sets visible", ->
197
- @setTimeoutSpy.andCallFake((timeout, callback) => callback())
197
+ @setTimeoutSpy.andCallFake((callback, timeout) => callback())
198
198
  @snippetToolbar.hide()
199
199
  expect(@snippetToolbar.visible).toEqual(false)
200
200
 
@@ -5,7 +5,7 @@ describe "Mercury.Toolbar.ButtonGroup", ->
5
5
  beforeEach ->
6
6
  Mercury.Toolbar.ButtonGroup.contexts.foo = -> false
7
7
  @region = {
8
- element: $('<div class="mercury-region">')
8
+ element: $('<div>')
9
9
  currentElement: -> $('<div>')
10
10
  }
11
11
 
@@ -50,8 +50,8 @@ describe "Mercury.Toolbar.ButtonGroup", ->
50
50
 
51
51
  beforeEach ->
52
52
  @region = {
53
- type: 'editable'
54
- element: $('<div class="mercury-region">')
53
+ type: -> 'full'
54
+ element: $('<div>')
55
55
  }
56
56
 
57
57
  it "disables if the region type isn't supported", ->
@@ -61,7 +61,7 @@ describe "Mercury.Toolbar.ButtonGroup", ->
61
61
  expect(@buttonGroup.hasClass('disabled')).toEqual(true)
62
62
 
63
63
  it "enables if the region type is supported", ->
64
- @buttonGroup = new Mercury.Toolbar.ButtonGroup('foo', {_regions: ['editable']})
64
+ @buttonGroup = new Mercury.Toolbar.ButtonGroup('foo', {_regions: ['full']})
65
65
  @buttonGroup.addClass('disabled')
66
66
  Mercury.trigger('region:focused', {region: @region})
67
67
  expect(@buttonGroup.hasClass('disabled')).toEqual(false)
@@ -69,7 +69,7 @@ describe "Mercury.Toolbar.ButtonGroup", ->
69
69
  describe "custom event: region:blurred", ->
70
70
 
71
71
  it "disables if it's a button group for specific region types", ->
72
- @buttonGroup = new Mercury.Toolbar.ButtonGroup('foo', {_regions: ['editable']})
72
+ @buttonGroup = new Mercury.Toolbar.ButtonGroup('foo', {_regions: ['full']})
73
73
  @buttonGroup.removeClass('disabled')
74
74
  Mercury.trigger('region:blurred', {region: @region})
75
75
 
@@ -3,11 +3,11 @@ describe "Mercury.Toolbar.Button", ->
3
3
  template 'mercury/toolbar.button.html'
4
4
 
5
5
  beforeEach ->
6
- Mercury.displayRect = {0, 0, 500, 200}
6
+ Mercury.displayRect = {top: 0, left: 0, width: 500, height: 200}
7
7
  Mercury.Toolbar.Button.contexts.foo = -> true
8
8
  @region = {
9
- type: 'editable'
10
- element: $('<div class="mercury-region">')
9
+ type: -> 'full'
10
+ element: $('<div>')
11
11
  currentElement: -> $('<div>')
12
12
  }
13
13
  Mercury.preloadedViews['/nothing'] = 'nothing'
@@ -166,7 +166,7 @@ describe "Mercury.Toolbar.Button", ->
166
166
  expect(@button.hasClass('disabled')).toEqual(true)
167
167
 
168
168
  it "enables if the region type is supported", ->
169
- @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {context: true, regions: ['editable']})
169
+ @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {context: true, regions: ['full']})
170
170
  @button.addClass('disabled')
171
171
  Mercury.trigger('region:focused', {region: @region})
172
172
  expect(@button.hasClass('disabled')).toEqual(false)
@@ -174,7 +174,7 @@ describe "Mercury.Toolbar.Button", ->
174
174
  describe "custom event: region:blurred", ->
175
175
 
176
176
  it "disables if it's a button for specific region types", ->
177
- @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {context: true, regions: ['editable']})
177
+ @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {context: true, regions: ['full']})
178
178
  @button.addClass('disabled')
179
179
  Mercury.trigger('region:blurred', {region: @region})
180
180
  expect(@button.hasClass('disabled')).toEqual(true)
@@ -219,7 +219,7 @@ describe "Mercury.Toolbar.Button", ->
219
219
 
220
220
  it "triggers a focus:frame event", ->
221
221
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
222
- @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {}, {regions: ['editable']})
222
+ @button = new Mercury.Toolbar.Button('foo', 'title', 'summary', {}, {regions: ['full']})
223
223
 
224
224
  jasmine.simulate.click(@button.get(0))
225
225
  expect(spy.argsForCall[1]).toEqual(['focus:frame'])
@@ -48,7 +48,7 @@ describe "Mercury.Toolbar", ->
48
48
  it "builds out toolbar elements from the configuration", ->
49
49
  expect($('.mercury-primary-toolbar').length).toEqual(1)
50
50
  expect($('.mercury-editable-toolbar').length).toEqual(1)
51
- expect($('.mercury-editable-toolbar').data('regions')).toEqual('editable,markupable')
51
+ expect($('.mercury-editable-toolbar').data('regions')).toEqual('full,markdown')
52
52
 
53
53
  it "builds buttons etc.", ->
54
54
  expect(@buildButtonSpy.callCount).toBeGreaterThan(10)
@@ -133,18 +133,18 @@ describe "Mercury.Toolbar", ->
133
133
 
134
134
  it "enables toolbars based on the region type", ->
135
135
  $('.mercury-editable-toolbar').addClass('disabled')
136
- Mercury.trigger('region:focused', {region: {type: 'editable'}})
136
+ Mercury.trigger('region:focused', {region: {type: -> 'full'}})
137
137
  expect($('.mercury.editable-toolbar').hasClass('disabled')).toEqual(false)
138
138
 
139
139
  $('.mercury-editable-toolbar').addClass('disabled')
140
- Mercury.trigger('region:focused', {region: {type: 'markupable'}})
140
+ Mercury.trigger('region:focused', {region: {type: -> 'markdown'}})
141
141
  expect($('.mercury.editable-toolbar').hasClass('disabled')).toEqual(false)
142
142
 
143
143
  describe "custom event: region:blurred", ->
144
144
 
145
145
  it "disables toolbars for the region type", ->
146
146
  $('.mercury-editable-toolbar').removeClass('disabled')
147
- Mercury.trigger('region:blurred', {region: {type: 'editable'}})
147
+ Mercury.trigger('region:blurred', {region: {type: -> 'full'}})
148
148
  expect($('.mercury-editable-toolbar').hasClass('disabled')).toEqual(true)
149
149
 
150
150
  describe "click", ->