             next =>
               expect(@revealOptions.scrollBehavior).toEqual('auto')
 
+      describe 'with { restoreScroll: true } option', ->
+
+        beforeEach ->
+          up.history.config.enabled = true
+
+        it 'restores the scroll positions of all viewports around the target', asyncSpec (next) ->
+
+          $viewport = $fixture('div[up-viewport] .element').css
+            'height': '100px'
+            'width': '100px'
+            'overflow-y': 'scroll'
+
+          respond = =>
+            @lastRequest().respondWith
+              status: 200
+              contentType: 'text/html'
+              responseText: '<div class="element" style="height: 300px"></div>'
+
+          up.change('.element', url: '/foo')
+
+          next => respond()
+          next => $viewport.scrollTop(65)
+          next => up.replace('.element', '/bar')
+          next => respond()
+          next => $viewport.scrollTop(0)
+          next.await => up.replace('.element', '/foo', restoreScroll: true)
+          # No need to respond because /foo has been cached before
+          next => expect($viewport.scrollTop()).toEqual(65)
 
       describe 'execution of scripts', ->
 

    ##############################################################################
    ##############################################################################

    describe 'up.replace', ->

      describeCapability 'canPushState', ->


              expect(result.state).toEqual('rejected')
              expect(result.value).toMatch(/Could not match target in current page and response/i)
              done()

      describe 'choice of target', ->

