spec/javascripts/mercury/modals/insertlink_spec.js.coffee in mercury-rails-0.1.2 vs spec/javascripts/mercury/modals/insertlink_spec.js.coffee in mercury-rails-0.2.0
- old
+ new
@@ -1,6 +1,6 @@
-require '/assets/mercury/mercury.js'
+require '/assets/mercury.js'
describe "Mercury.modalHandlers.insertLink", ->
template 'mercury/modals/insertlink.html'
@@ -54,20 +54,26 @@
describe "when editing", ->
describe "a standard link", ->
beforeEach ->
- Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo')}
+ Mercury.region = selection: => {
+ commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo'),
+ textContent: -> 'content'
+ }
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", ->
expect($('#link_external_url').val()).toEqual('http://cnn.com')
it "selects the target if one's available", ->
expect($('#link_target').val()).toEqual('_top')
+
+ it "fills the content", ->
+ expect($('#link_text').val()).toEqual('content')
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')}