spec_app/spec/javascripts/up/navigation_spec.js.coffee in upjs-rails-0.9.1 vs spec_app/spec/javascripts/up/navigation_spec.js.coffee in upjs-rails-0.10.0
- old
+ new
@@ -37,33 +37,33 @@
$otherLink = up.ready(affix('span[up-alias="/bar"]'))
expect($currentLink).toHaveClass('up-current')
expect($otherLink).not.toHaveClass('up-current')
it 'allows to configure a custom "current" class, but always also sets .up-current', ->
- up.navigation.defaults(currentClass: 'highlight')
+ up.navigation.defaults(currentClasses: ['highlight'])
spyOn(up.browser, 'url').and.returnValue('/foo')
$currentLink = up.ready(affix('a[href="/foo"]'))
expect($currentLink).toHaveClass('highlight up-current')
if up.browser.canPushState()
it 'marks a link as .up-current if it links to the current URL, but is missing a trailing slash', ->
$link = affix('a[href="/foo"][up-target=".main"]')
affix('.main')
$link.click()
- jasmine.Ajax.requests.mostRecent().respondWith
+ @lastRequest().respondWith
status: 200
contentType: 'text/html'
responseHeaders: { 'X-Up-Location': '/foo/' }
responseText: '<div class="main">new-text</div>'
expect($link).toHaveClass('up-current')
it 'marks a link as .up-current if it links to the current URL, but has an extra trailing slash', ->
$link = affix('a[href="/foo/"][up-target=".main"]')
affix('.main')
$link.click()
- jasmine.Ajax.requests.mostRecent().respondWith
+ @lastRequest().respondWith
status: 200
contentType: 'text/html'
responseHeaders: { 'X-Up-Location': '/foo' }
responseText: '<div class="main">new-text</div>'
expect($link).toHaveClass('up-current')
@@ -78,11 +78,11 @@
$link = affix('a[href="/foo"][up-target=".main"]')
affix('.main')
$link.click()
# console.log($link)
expect($link).toHaveClass('up-active')
- jasmine.Ajax.requests.mostRecent().respondWith
+ @lastRequest().respondWith
status: 200
contentType: 'text/html'
responseText: '<div class="main">new-text</div>'
expect($link).not.toHaveClass('up-active')
expect($link).toHaveClass('up-current')
@@ -90,11 +90,11 @@
it 'marks links with [up-instant] on mousedown as .up-active until the request finishes', ->
$link = affix('a[href="/foo"][up-instant][up-target=".main"]')
affix('.main')
Trigger.mousedown($link)
expect($link).toHaveClass('up-active')
- jasmine.Ajax.requests.mostRecent().respondWith
+ @lastRequest().respondWith
status: 200
contentType: 'text/html'
responseText: '<div class="main">new-text</div>'
expect($link).not.toHaveClass('up-active')
expect($link).toHaveClass('up-current')
@@ -104,10 +104,10 @@
up.ready($area)
$link = $area.find('a')
affix('.main')
$link.click()
expect($area).toHaveClass('up-active')
- jasmine.Ajax.requests.mostRecent().respondWith
+ @lastRequest().respondWith
status: 200
contentType: 'text/html'
responseText: '<div class="main">new-text</div>'
expect($area).toHaveClass('up-current')
\ No newline at end of file