             expect(spy).toHaveBeenCalledWith('old text', $parent)
             done()
 
+      it 'focuses an [autofocus] element in the new fragment', asyncSpec (next) ->
+        $fixture('.foo-bar')
+        up.change '.foo-bar', document: """
+          <form class='foo-bar'>
+            <input class="autofocused-input" autofocus>
+          </form>
+        """
+
+        next =>
+          input = $('.autofocused-input').get(0)
+          expect(input).toBeGiven()
+          expect(document.activeElement).toBe(input)
 
       describeCapability 'canCustomElements', ->
 


      describe 'with { transition } option', ->

        it 'returns a promise that will be fulfilled once the server response was received and the swap transition has completed', asyncSpec (next) ->
          fixture('.target', text: 'old-text')
          resolution = jasmine.createSpy()
          promise = up.change(target: '.target', url: '/path', transition: 'cross-fade', duration: 200)
          promise.then(resolution)

          next =>
            expect(resolution).not.toHaveBeenCalled()
            expect('.target').toHaveText('old-text')
            @respondWith '<div class="target">new-text</div>'

          next.after 100, =>
            target = e.first('.target')
            opacity = e.styleNumber(target, 'opacity')
            expect(opacity).toBeAround(0.5, 0.4)
            expect(resolution).not.toHaveBeenCalled()

          next.after 200, =>
            expect(resolution).toHaveBeenCalled()
            expect('.target').toHaveText('new-text')

      describe 'with { reveal } option', ->


          $elements = $('.foo-bar')
          expect($($elements.get(0)).text()).toEqual('text')
          expect($($elements.get(1)).text()).toEqual('')

      describe 'with { scrollBehavior } option', ->

