 windowSpy = sinon.spy();
          ajax.addEventListener('iron-ajax-presend', spy);
          window.addEventListener('iron-ajax-presend', windowSpy);

          var request = ajax.generateRequest();

          server.respond()

          return request.completes.then(function() {
            expect(spy).to.be.calledOnce;
            expect(windowSpy).not.to.be.called;
          });
        });

        test('the loading-changed event gets fired twice', function() {
          var count = 0;
          ajax.