mercury-rails 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/README.rdoc +8 -3
  2. data/VERSION +1 -1
  3. data/app/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
  4. data/app/assets/javascripts/mercury/mercury.js.coffee +2 -2
  5. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +3 -6
  6. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +6 -6
  7. data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +3 -2
  8. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +8 -8
  9. data/app/assets/javascripts/mercury/page_editor.js.coffee +6 -0
  10. data/app/assets/javascripts/mercury/snippet.js.coffee +1 -1
  11. data/app/assets/stylesheets/mercury/dialog.scss +1 -0
  12. data/app/assets/stylesheets/mercury/mercury.scss +8 -0
  13. data/app/assets/stylesheets/mercury/modal.scss +3 -1
  14. data/app/assets/stylesheets/mercury/statusbar.scss +1 -0
  15. data/app/views/layouts/mercury.html.haml +4 -4
  16. data/mercury-rails.gemspec +24 -2
  17. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +39 -0
  18. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +39 -0
  19. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +27 -0
  20. data/spec/javascripts/mercury/dialogs/objectspanel_spec.js.coffee +32 -0
  21. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +27 -0
  22. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +32 -0
  23. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +30 -0
  24. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +216 -0
  25. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +167 -0
  26. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +54 -0
  27. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +162 -0
  28. data/spec/javascripts/mercury/panel_spec.js.coffee +1 -1
  29. data/spec/javascripts/mercury/snippet_spec.js.coffee +1 -1
  30. data/spec/javascripts/spec_helper.js +0 -1
  31. data/spec/javascripts/templates/mercury/dialogs/backcolor.html +5 -0
  32. data/spec/javascripts/templates/mercury/dialogs/forecolor.html +5 -0
  33. data/spec/javascripts/templates/mercury/dialogs/formatblock.html +3 -0
  34. data/spec/javascripts/templates/mercury/dialogs/objectspanel.html +16 -0
  35. data/spec/javascripts/templates/mercury/dialogs/style.html +3 -0
  36. data/spec/javascripts/templates/mercury/modals/htmleditor.html +5 -0
  37. data/spec/javascripts/templates/mercury/modals/insertcharacter.html +5 -0
  38. data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
  39. data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
  40. data/spec/javascripts/templates/mercury/modals/insertsnippet.html +6 -0
  41. data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
  42. metadata +25 -3
@@ -0,0 +1,27 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.dialogHandlers.style", ->
4
+
5
+ template 'mercury/dialogs/style.html'
6
+
7
+ beforeEach ->
8
+ @dialog = {element: $('#test')}
9
+ Mercury.dialogHandlers.style.call(@dialog)
10
+
11
+ describe "when an element with a data-class attribute is clicked", ->
12
+
13
+ it "triggers an action", ->
14
+ spy = spyOn(Mercury, 'trigger').andCallFake(=>)
15
+ jasmine.simulate.click($('#red').get(0))
16
+ expect(spy.callCount).toEqual(1)
17
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'style', value: 'red'}])
18
+ jasmine.simulate.click($('#bold').get(0))
19
+ expect(spy.argsForCall[1]).toEqual(['action', {action: 'style', value: 'bold'}])
20
+
21
+
22
+ describe "when any other element is clicked", ->
23
+
24
+ it "does nothing", ->
25
+ spy = spyOn(Mercury, 'trigger').andCallFake(=>)
26
+ jasmine.simulate.click($('#blue').get(0))
27
+ expect(spy.callCount).toEqual(0)
@@ -0,0 +1,32 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.modalHandlers.htmleditor", ->
4
+
5
+ template 'mercury/modals/htmleditor.html'
6
+
7
+ beforeEach ->
8
+ @modal =
9
+ element: $('#test')
10
+ hide: ->
11
+ Mercury.region =
12
+ html: -> '<span>html \ncontent</span>'
13
+ Mercury.modalHandlers.htmleditor.call(@modal)
14
+
15
+ describe "loading", ->
16
+
17
+ it "sets the value of the textarea", ->
18
+ expect($('#test textarea').val()).toEqual('<span>html \ncontent</span>')
19
+
20
+
21
+ describe "submitting", ->
22
+
23
+ it "triggers a replaceHTML action", ->
24
+ spy = spyOn(Mercury, 'trigger').andCallFake(=>)
25
+ jasmine.simulate.click($('#submit').get(0))
26
+ expect(spy.callCount).toEqual(1)
27
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html content</span>'}])
28
+
29
+ it "hides the modal", ->
30
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
31
+ jasmine.simulate.click($('#submit').get(0))
32
+ expect(spy.callCount).toEqual(1)
@@ -0,0 +1,30 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.modalHandlers.insertcharacter", ->
4
+
5
+ template 'mercury/modals/insertcharacter.html'
6
+
7
+ beforeEach ->
8
+ @modal =
9
+ element: $('#test')
10
+ @modalHideSpy = spyOn(Mercury.modal, 'hide').andCallFake(=>)
11
+ Mercury.modalHandlers.insertcharacter.call(@modal)
12
+
13
+ describe "clicking on a character", ->
14
+
15
+ it "triggers an action event", ->
16
+ spy = spyOn(Mercury, 'trigger').andCallFake(=>)
17
+ jasmine.simulate.click($('#char1').get(0))
18
+ expect(spy.callCount).toEqual(1)
19
+ expect(spy.argsForCall[0]).toEqual(['action', {action: 'insertHTML', value: "&#34;"}])
20
+
21
+ it "hides the modal", ->
22
+ jasmine.simulate.click($('#char2').get(0))
23
+ expect(@modalHideSpy.callCount).toEqual(1)
24
+
25
+
26
+ describe "clicking on any other element", ->
27
+
28
+ it "does nothing", ->
29
+ jasmine.simulate.click($('#char3').get(0))
30
+ expect(@modalHideSpy.callCount).toEqual(0)
@@ -0,0 +1,216 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.modalHandlers.insertlink", ->
4
+
5
+ template 'mercury/modals/insertlink.html'
6
+
7
+ beforeEach ->
8
+ Mercury.region = null
9
+ @modal =
10
+ element: $('#test')
11
+ hide: ->
12
+ resize: ->
13
+ window.mercuryInstance = {document: $(document)}
14
+
15
+ describe "initializing", ->
16
+
17
+ beforeEach ->
18
+ Mercury.modalHandlers.insertlink.call(@modal)
19
+
20
+ it "loads all links with a name into the existing bookmarks pulldown", ->
21
+ options = $('#link_existing_bookmark').html()
22
+ expect(options).toContain('link1')
23
+ expect(options).toContain('link2')
24
+ expect(options).toContain('Link Two')
25
+
26
+
27
+ describe "clicking on a radio button (in a label)", ->
28
+
29
+ beforeEach ->
30
+ Mercury.modalHandlers.insertlink.call(@modal)
31
+
32
+ it "focuses the next input with a selectable class", ->
33
+ spy = spyOn($.fn, 'focus').andCallFake(=>)
34
+ jasmine.simulate.click($('#checkbox1').get(0))
35
+ expect(spy.callCount).toEqual(1)
36
+
37
+
38
+ describe "focusing an input", ->
39
+
40
+ beforeEach ->
41
+ Mercury.modalHandlers.insertlink.call(@modal)
42
+
43
+ it "checks the corresponding checkbox", ->
44
+ $('#link_existing_bookmark').focus()
45
+ expect($('#checkbox2').get(0).checked).toEqual(true)
46
+
47
+
48
+ describe "changing the link target", ->
49
+
50
+ it "shows options for whatever was selected", ->
51
+ it "calls resize", ->
52
+
53
+
54
+ describe "when editing", ->
55
+
56
+ describe "a standard link", ->
57
+
58
+ beforeEach ->
59
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo')}
60
+ Mercury.modalHandlers.insertlink.call(@modal)
61
+
62
+ it "hides the link text input", ->
63
+ expect($('#link_text_container').css('display')).toEqual('none')
64
+
65
+ it "pre-fills the link url input", ->
66
+ expect($('#link_external_url').val()).toEqual('http://cnn.com')
67
+
68
+ it "selects the target if one's available", ->
69
+ expect($('#link_target').val()).toEqual('_top')
70
+
71
+ describe "a javascript popup link", ->
72
+
73
+ beforeEach ->
74
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}).html('foo')}
75
+ Mercury.modalHandlers.insertlink.call(@modal)
76
+
77
+ it "hides the link text input", ->
78
+ expect($('#link_text_container').css('display')).toEqual('none')
79
+
80
+ it "pre-fills the link url input", ->
81
+ expect($('#link_external_url').val()).toEqual('http://cnn.com')
82
+
83
+ it "selects the target", ->
84
+ expect($('#link_target').val()).toEqual('popup')
85
+
86
+ it "sets the width and height by parsing them out of the href", ->
87
+ expect($('#link_popup_width').val()).toEqual('100')
88
+ expect($('#link_popup_height').val()).toEqual('42')
89
+
90
+ describe "a bookmark link", ->
91
+
92
+ beforeEach ->
93
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')}
94
+ Mercury.modalHandlers.insertlink.call(@modal)
95
+
96
+ it "hides the link text input", ->
97
+ expect($('#link_text_container').css('display')).toEqual('none')
98
+
99
+ it "checks the existing bookmark radio", ->
100
+ expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
101
+
102
+ it "selects the correct option from the list", ->
103
+ expect($('#link_existing_bookmark').val()).toEqual('link2')
104
+
105
+ describe "a bookmark target", ->
106
+
107
+ beforeEach ->
108
+ Mercury.region = selection: => {commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')}
109
+ Mercury.modalHandlers.insertlink.call(@modal)
110
+
111
+ it "hides the link text input", ->
112
+ expect($('#link_text_container').css('display')).toEqual('none')
113
+
114
+ it "checks the new bookmark radio", ->
115
+ expect($('input[value=new_bookmark]').get(0).checked).toEqual(true)
116
+
117
+ it "sets the link name input", ->
118
+ expect($('#link_new_bookmark').val()).toEqual('link3')
119
+
120
+
121
+ describe "submitting", ->
122
+
123
+ describe "a new link", ->
124
+
125
+ beforeEach ->
126
+ Mercury.modalHandlers.insertlink.call(@modal)
127
+ @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
128
+ $('#link_text').val('foo')
129
+
130
+ it "hides the modal", ->
131
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
132
+ jasmine.simulate.click($('#submit').get(0))
133
+ expect(spy.callCount).toEqual(1)
134
+
135
+ describe "as a standard link", ->
136
+
137
+ beforeEach ->
138
+ $('#link_external_url').val('http://cnn.com')
139
+ $('#link_target').val('_top')
140
+
141
+ it "triggers an action with the proper values", ->
142
+ jasmine.simulate.click($('#submit').get(0))
143
+ expect(@triggerSpy.callCount).toEqual(1)
144
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
145
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
146
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({tagName: 'a', attrs: {href: 'http://cnn.com', target: '_top'}, content: 'foo'})
147
+
148
+ describe "as a javascript popup", ->
149
+
150
+ beforeEach ->
151
+ $('#link_external_url').val('http://cnn.com')
152
+ $('#link_target').val('popup')
153
+ $('#link_popup_width').val(100)
154
+ $('#link_popup_height').val('42')
155
+
156
+ it "triggers an action with the proper values", ->
157
+ jasmine.simulate.click($('#submit').get(0))
158
+ expect(@triggerSpy.callCount).toEqual(1)
159
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
160
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
161
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({tagName: 'a', attrs: {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}, content: 'foo'})
162
+
163
+ describe "as an existing bookmark", ->
164
+
165
+ beforeEach ->
166
+ $('#link_existing_bookmark').val('link2')
167
+ $('input[value=existing_bookmark]').prop('checked', true)
168
+
169
+ it "triggers an action with the proper values", ->
170
+ jasmine.simulate.click($('#submit').get(0))
171
+ expect(@triggerSpy.callCount).toEqual(1)
172
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
173
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
174
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({tagName: 'a', attrs: {href: '#link2'}, content: 'foo'})
175
+
176
+ describe "as a new bookmark", ->
177
+
178
+ beforeEach ->
179
+ $('#link_new_bookmark').val('link3')
180
+ $('input[value=new_bookmark]').prop('checked', true)
181
+
182
+ it "triggers an action with the proper values", ->
183
+ jasmine.simulate.click($('#submit').get(0))
184
+ expect(@triggerSpy.callCount).toEqual(1)
185
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
186
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
187
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({tagName: 'a', attrs: {name: 'link3'}, content: 'foo'})
188
+
189
+ describe "editing an existing link", ->
190
+
191
+ beforeEach ->
192
+ @existingLink = $('<a>', {name: 'link3'}).html('foo')
193
+ Mercury.region = selection: => {commonAncestor: => @existingLink}
194
+ Mercury.modalHandlers.insertlink.call(@modal)
195
+ @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
196
+ $('#link_text').val('foo')
197
+
198
+ it "hides the modal", ->
199
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
200
+ jasmine.simulate.click($('#submit').get(0))
201
+ expect(spy.callCount).toEqual(1)
202
+
203
+ describe "as a standard link", ->
204
+
205
+ beforeEach ->
206
+ $('#link_external_url').val('http://cnn.com')
207
+ $('#link_target').val('_top')
208
+ $('input[value=external_url]').prop('checked', true)
209
+
210
+ it "triggers an action with the proper values", ->
211
+ jasmine.simulate.click($('#submit').get(0))
212
+ expect(@triggerSpy.callCount).toEqual(1)
213
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
214
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('replaceLink')
215
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({tagName: 'a', attrs: {href: 'http://cnn.com', target: '_top'}, content: 'foo'})
216
+ expect(@triggerSpy.argsForCall[0][1]['node']).toEqual(@existingLink.get(0))
@@ -0,0 +1,167 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.modalHandlers.insertmedia", ->
4
+
5
+ template 'mercury/modals/insertmedia.html'
6
+
7
+ beforeEach ->
8
+ Mercury.region = null
9
+ @modal =
10
+ element: $('#test')
11
+ hide: ->
12
+ resize: ->
13
+
14
+ describe "clicking on a radio button (in a label)", ->
15
+
16
+ beforeEach ->
17
+ Mercury.modalHandlers.insertmedia.call(@modal)
18
+
19
+ it "focuses the next input with a selectable class", ->
20
+ spy = spyOn($.fn, 'focus').andCallFake(=>)
21
+ jasmine.simulate.click($('#checkbox1').get(0))
22
+ expect(spy.callCount).toEqual(1)
23
+
24
+ describe "focusing an input", ->
25
+
26
+ beforeEach ->
27
+ Mercury.modalHandlers.insertmedia.call(@modal)
28
+
29
+ it "checks the corresponding checkbox", ->
30
+ $('#media_youtube_url').focus()
31
+ expect($('#checkbox2').get(0).checked).toEqual(true)
32
+
33
+ it "hides all the option divs", ->
34
+ $('#media_youtube_url').focus()
35
+ expect($('#image_url').css('display')).toEqual('none')
36
+ expect($('#vimeo_url').css('display')).toEqual('none')
37
+
38
+ it "shows the options for the item that was focused", ->
39
+ $('#media_youtube_url').focus()
40
+ expect($('#youtube_url').css('display')).toNotEqual('none')
41
+
42
+ it "calls resize", ->
43
+ spy = spyOn(@modal, 'resize').andCallFake(=>)
44
+ $('#media_youtube_url').focus()
45
+ expect(spy.callCount).toEqual(1)
46
+
47
+
48
+ describe "when editing", ->
49
+
50
+ describe "an existing image", ->
51
+
52
+ beforeEach ->
53
+ @focusSpy = spyOn($.fn, 'focus').andCallThrough()
54
+ @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
55
+ Mercury.region = selection: => @selection
56
+ Mercury.modalHandlers.insertmedia.call(@modal)
57
+
58
+ it "pre-fills the image url", ->
59
+ expect($('#media_image_url').val()).toEqual('/foo.gif')
60
+
61
+ it "focuses the url input", ->
62
+ expect(@focusSpy.callCount).toEqual(1)
63
+ expect($('input[value=image_url]').get(0).checked).toEqual(true)
64
+
65
+ it "sets the image alignment option", ->
66
+ expect($('#media_image_alignment').val()).toEqual('right')
67
+
68
+ describe "an existing youtube video", ->
69
+
70
+ beforeEach ->
71
+ @focusSpy = spyOn($.fn, 'focus').andCallThrough()
72
+ @selection = {is: -> $('<iframe>', {src: 'http://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
73
+ Mercury.region = selection: => @selection
74
+ Mercury.modalHandlers.insertmedia.call(@modal)
75
+
76
+ it "pre-fills the url", ->
77
+ expect($('#media_youtube_url').val()).toEqual('http://youtu.be/foo')
78
+
79
+ it "focuses the url input", ->
80
+ expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
81
+
82
+ it "sets the width option", ->
83
+ expect($('#media_youtube_width').val()).toEqual('100')
84
+
85
+ it "sets the height option", ->
86
+ expect($('#media_youtube_height').val()).toEqual('42')
87
+
88
+ describe "an existing vimeo video", ->
89
+
90
+ beforeEach ->
91
+ @focusSpy = spyOn($.fn, 'focus').andCallThrough()
92
+ @selection = {is: -> $('<iframe>', {src: 'http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff', style: 'width:100px;height:42px'})}
93
+ Mercury.region = selection: => @selection
94
+ Mercury.modalHandlers.insertmedia.call(@modal)
95
+
96
+ it "pre-fills the url", ->
97
+ expect($('#media_vimeo_url').val()).toEqual('http://vimeo.com/foo')
98
+
99
+ it "focuses the url input", ->
100
+ expect($('input[value=vimeo_url]').get(0).checked).toEqual(true)
101
+
102
+ it "sets the width option", ->
103
+ expect($('#media_vimeo_width').val()).toEqual('100')
104
+
105
+ it "sets the height option", ->
106
+ expect($('#media_vimeo_height').val()).toEqual('42')
107
+
108
+
109
+ describe "submitting", ->
110
+
111
+ beforeEach ->
112
+ Mercury.modalHandlers.insertmedia.call(@modal)
113
+ @triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
114
+
115
+ it "hides the modal", ->
116
+ spy = spyOn(@modal, 'hide').andCallFake(=>)
117
+ jasmine.simulate.click($('#submit').get(0))
118
+ expect(spy.callCount).toEqual(1)
119
+
120
+ describe "an image", ->
121
+
122
+ beforeEach ->
123
+ $('#media_image_url').val('http://domain/foo.gif')
124
+ $('#media_image_alignment').val('right')
125
+
126
+ it "triggers an action with the proper values", ->
127
+ jasmine.simulate.click($('#submit').get(0))
128
+ expect(@triggerSpy.callCount).toEqual(1)
129
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
130
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertImage')
131
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right'})
132
+
133
+ describe "a youtube video", ->
134
+
135
+ beforeEach ->
136
+ $('#media_youtube_url').val('http://youtu.be/foo')
137
+ $('#media_youtube_width').val(100)
138
+ $('#media_youtube_height').val('42')
139
+ $('input[value=youtube_url]').prop('checked', true)
140
+
141
+ it "triggers an action with the proper values", ->
142
+ jasmine.simulate.click($('#submit').get(0))
143
+ expect(@triggerSpy.callCount).toEqual(1)
144
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
145
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
146
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
147
+ expect(value).toContain('100px')
148
+ expect(value).toContain('42px')
149
+ expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
150
+
151
+ describe "a vimeo video", ->
152
+
153
+ beforeEach ->
154
+ $('#media_vimeo_url').val('http://vimeo.com/foo')
155
+ $('#media_vimeo_width').val(100)
156
+ $('#media_vimeo_height').val('42')
157
+ $('input[value=vimeo_url]').prop('checked', true)
158
+
159
+ it "triggers an action with the proper values", ->
160
+ jasmine.simulate.click($('#submit').get(0))
161
+ expect(@triggerSpy.callCount).toEqual(1)
162
+ expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
163
+ expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
164
+ value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
165
+ expect(value).toContain('100px')
166
+ expect(value).toContain('42px')
167
+ expect(value).toContain('http://player.vimeo.com/video/foo?title=1&amp;byline=1&amp;portrait=0&amp;color=ffffff')