spec/javascripts/mercury/modals/insertmedia_spec.js.coffee in mercury-rails-0.8.0 vs spec/javascripts/mercury/modals/insertmedia_spec.js.coffee in mercury-rails-0.9.0
- old
+ new
@@ -51,11 +51,11 @@
describe "an existing image", ->
beforeEach ->
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
- @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
+ @selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right', style: 'float: left;'})}
Mercury.region = selection: => @selection
@insertMedia.initialize()
it "pre-fills the image url", ->
expect($('#media_image_url').val()).toEqual('/foo.gif')
@@ -65,10 +65,13 @@
expect($('input[value=image_url]').get(0).checked).toEqual(true)
it "sets the image alignment option", ->
expect($('#media_image_alignment').val()).toEqual('right')
+ it "sets the image float option", ->
+ expect($('#media_image_float').val()).toEqual('left')
+
describe "an existing youtube video", ->
beforeEach ->
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
@selection = {is: -> $('<iframe>', {src: 'https://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
@@ -174,16 +177,17 @@
describe "an image", ->
beforeEach ->
$('#media_image_url').val('http://domain/foo.gif')
$('#media_image_alignment').val('right')
+ $('#media_image_float').val('left')
it "triggers an action with the proper values", ->
jasmine.simulate.click($('input[type=submit]').get(0))
expect(@triggerSpy.callCount).toEqual(1)
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertImage')
- expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right'})
+ expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right', style: 'float: left;'})
describe "a youtube video", ->
beforeEach ->
$('#media_youtube_url').val('http://youtu.be/foo')