spec_app/spec/javascripts/up/history_spec.js.coffee in upjs-rails-0.17.0 vs spec_app/spec/javascripts/up/history_spec.js.coffee in upjs-rails-0.18.0
- old
+ new
@@ -12,11 +12,11 @@
describe 'unobtrusive behavior', ->
describe '[up-back]', ->
- if up.browser.canPushState()
+ describeCapability 'canPushState', ->
it 'sets an [up-href] attribute to the previous URL and sets the up-restore-scroll attribute to "true"', ->
up.history.push('/one')
up.history.push('/two')
$element = up.hello(affix('a[href="/three"][up-back]').text('text'))
@@ -27,12 +27,18 @@
it 'does not overwrite an existing up-href or up-restore-scroll attribute'
it 'does not set an up-href attribute if there is no previous URL'
+ describeFallback 'canPushState', ->
+
+ it 'does not change the element', ->
+ $element = up.hello(affix('a[href="/three"][up-back]').text('text'))
+ expect($element.attr('up-href')).toBeUndefined()
+
describe 'scroll restauration', ->
- if up.browser.canPushState()
+ describeCapability 'canPushState', ->
afterEach ->
$('.viewport').remove()
it 'restores the scroll position of viewports when the user hits the back button', (done) ->