spec_app/spec/javascripts/up/popup_spec.js.coffee in upjs-rails-0.17.0 vs spec_app/spec/javascripts/up/popup_spec.js.coffee in upjs-rails-0.18.0
- old
+ new
@@ -43,22 +43,24 @@
expect(respond).not.toThrowError()
expect($('.up-error')).not.toExist()
describe 'up.popup.coveredUrl', ->
- it 'returns the URL behind the popup', (done) ->
- up.history.replace('/foo')
- expect(up.popup.coveredUrl()).toBeUndefined()
+ describeCapability 'canPushState', ->
- $popupLink = affix('a[href="/bar"][up-popup=".container"]')
- $popupLink.click()
- @respondWith('<div class="container">text</div>')
- expect(up.popup.coveredUrl()).toEndWith('/foo')
- up.popup.close().then ->
+ it 'returns the URL behind the popup', (done) ->
+ up.history.replace('/foo')
expect(up.popup.coveredUrl()).toBeUndefined()
- done()
+ $popupLink = affix('a[href="/bar"][up-popup=".container"]')
+ $popupLink.click()
+ @respondWith('<div class="container">text</div>')
+ expect(up.popup.coveredUrl()).toEndWith('/foo')
+ up.popup.close().then ->
+ expect(up.popup.coveredUrl()).toBeUndefined()
+ done()
+
describe 'up.popup.close', ->
it 'should have tests'
describe 'up.popup.source', ->
@@ -76,22 +78,28 @@
it 'opens the clicked link in a popup', ->
Trigger.click(@$link)
expect(@attachSpy).toHaveBeenCalledWith(@$link)
- it 'does nothing if the right mouse button is used', ->
- Trigger.click(@$link, button: 2)
- expect(@attachSpy).not.toHaveBeenCalled()
+ # IE does not call Javascript and always performs the default action on right clicks
+ unless navigator.userAgent.match(/Trident/)
+ it 'does nothing if the right mouse button is used', ->
+ Trigger.click(@$link, button: 2)
+ expect(@attachSpy).not.toHaveBeenCalled()
it 'does nothing if shift is pressed during the click', ->
Trigger.click(@$link, shiftKey: true)
expect(@attachSpy).not.toHaveBeenCalled()
it 'does nothing if ctrl is pressed during the click', ->
Trigger.click(@$link, ctrlKey: true)
expect(@attachSpy).not.toHaveBeenCalled()
+ it 'does nothing if meta is pressed during the click', ->
+ Trigger.click(@$link, metaKey: true)
+ expect(@attachSpy).not.toHaveBeenCalled()
+
describe 'with [up-instant] modifier', ->
beforeEach ->
@$link.attr('up-instant', '')
@@ -105,12 +113,14 @@
it 'does nothing on click', ->
Trigger.click(@$link)
expect(@attachSpy).not.toHaveBeenCalled()
- it 'does nothing if the right mouse button is pressed down', ->
- Trigger.mousedown(@$link, button: 2)
- expect(@attachSpy).not.toHaveBeenCalled()
+ # IE does not call Javascript and always performs the default action on right clicks
+ unless navigator.userAgent.match(/Trident/)
+ it 'does nothing if the right mouse button is pressed down', ->
+ Trigger.mousedown(@$link, button: 2)
+ expect(@attachSpy).not.toHaveBeenCalled()
it 'does nothing if shift is pressed during mousedown', ->
Trigger.mousedown(@$link, shiftKey: true)
expect(@attachSpy).not.toHaveBeenCalled()