spec/javascripts/mercury/modals/insertlink_spec.js.coffee in mercury-rails-0.1.1 vs spec/javascripts/mercury/modals/insertlink_spec.js.coffee in mercury-rails-0.1.2
- old
+ new
@@ -1,8 +1,8 @@
require '/assets/mercury/mercury.js'
-describe "Mercury.modalHandlers.insertlink", ->
+describe "Mercury.modalHandlers.insertLink", ->
template 'mercury/modals/insertlink.html'
beforeEach ->
Mercury.region = null
@@ -13,11 +13,11 @@
window.mercuryInstance = {document: $(document)}
describe "initializing", ->
beforeEach ->
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "loads all links with a name into the existing bookmarks pulldown", ->
options = $('#link_existing_bookmark').html()
expect(options).toContain('link1')
expect(options).toContain('link2')
@@ -25,22 +25,22 @@
describe "clicking on a radio button (in a label)", ->
beforeEach ->
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "focuses the next input with a selectable class", ->
spy = spyOn($.fn, 'focus').andCallFake(=>)
jasmine.simulate.click($('#checkbox1').get(0))
expect(spy.callCount).toEqual(1)
describe "focusing an input", ->
beforeEach ->
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "checks the corresponding checkbox", ->
$('#link_existing_bookmark').focus()
expect($('#checkbox2').get(0).checked).toEqual(true)
@@ -55,11 +55,11 @@
describe "a standard link", ->
beforeEach ->
Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo')}
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "hides the link text input", ->
expect($('#link_text_container').css('display')).toEqual('none')
it "pre-fills the link url input", ->
@@ -70,11 +70,11 @@
describe "a javascript popup link", ->
beforeEach ->
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')}
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "hides the link text input", ->
expect($('#link_text_container').css('display')).toEqual('none')
it "pre-fills the link url input", ->
@@ -89,11 +89,11 @@
describe "a bookmark link", ->
beforeEach ->
Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')}
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "hides the link text input", ->
expect($('#link_text_container').css('display')).toEqual('none')
it "checks the existing bookmark radio", ->
@@ -104,11 +104,11 @@
describe "a bookmark target", ->
beforeEach ->
Mercury.region = selection: => {commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')}
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
it "hides the link text input", ->
expect($('#link_text_container').css('display')).toEqual('none')
it "checks the new bookmark radio", ->
@@ -121,11 +121,11 @@
describe "submitting", ->
describe "a new link", ->
beforeEach ->
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
$('#link_text').val('foo')
it "hides the modal", ->
spy = spyOn(@modal, 'hide').andCallFake(=>)
@@ -189,10 +189,10 @@
describe "editing an existing link", ->
beforeEach ->
@existingLink = $('<a>', {name: 'link3'}).html('foo')
Mercury.region = selection: => {commonAncestor: => @existingLink}
- Mercury.modalHandlers.insertlink.call(@modal)
+ Mercury.modalHandlers.insertLink.call(@modal)
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
$('#link_text').val('foo')
it "hides the modal", ->
spy = spyOn(@modal, 'hide').andCallFake(=>)