').html(@triggerSpy.argsForCall[0][1]['value']).html()
expect(value).toContain('100px')
expect(value).toContain('42px')
expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
it "triggers an action with the proper values using https", ->
$('#media_youtube_url').val('https://youtu.be/foo')
jasmine.simulate.click($('#submit').get(0))
expect(@triggerSpy.callCount).toEqual(1)
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
value = $('
').html(@triggerSpy.argsForCall[0][1]['value']).html()
expect(value).toContain('100px')
expect(value).toContain('42px')
expect(value).toContain('src="https://www.youtube.com/embed/foo?wmode=transparent"')
describe "a vimeo video", ->
beforeEach ->
$('#media_vimeo_url').val('http://vimeo.com/foo')
$('#media_vimeo_width').val(100)
$('#media_vimeo_height').val('42')
$('input[value=vimeo_url]').prop('checked', true)
it "doesn't allow bogus urls", ->
$('#media_vimeo_url').val('http://example.com')
lastAlert = ''
spy = spyOn(window, 'alert').andCallFake((msg) -> lastAlert = msg)
jasmine.simulate.click($('#submit').get(0))
expect(spy.callCount).toEqual(1)
expect(lastAlert).toEqual('Error: The provided vimeo url was invalid.')
it "triggers an action with the proper values", ->
$('#media_vimeo_url').val('http://vimeo.com/foo')
jasmine.simulate.click($('#submit').get(0))
expect(@triggerSpy.callCount).toEqual(1)
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
value = $('
').html(@triggerSpy.argsForCall[0][1]['value']).html()
expect(value).toContain('100px')
expect(value).toContain('42px')
expect(value).toContain('http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff')
it "triggers an action with the proper values using https", ->
$('#media_vimeo_url').val('https://vimeo.com/foo')
jasmine.simulate.click($('#submit').get(0))
expect(@triggerSpy.callCount).toEqual(1)
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
value = $('
').html(@triggerSpy.argsForCall[0][1]['value']).html()
expect(value).toContain('100px')
expect(value).toContain('42px')
expect(value).toContain('https://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff')