title: spyOn with argumented function in javascript. gives me error TypeError: e is undefined
body: <p>I am writting test case for javascript using jasmine but when I am creating spyOn to a function  and calling loginSubmit it is giving me error "TypeError: e is undefined" in that perticular function.</p>
  
  <p>My test code is as below:</p>
  
  <pre><code> describe('this will test for html fixtures and login function called', function (){
  
      beforeEach(function() {
          jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures';
          loadFixtures('login.fixtures.html');
      });
  
      it('expect fixtures to exist', function() {
          expect('form').toExist();
          expect('form').toContainElement('button');
      });
      spyOn(window, $.fn.loginSubmit());
      $('.submit').click();
  
      it('expect function to be called', function(){
          expect(loginSubmit).toBeCalled();
      });
      });
  </code></pre>
  
  <p>and Javascript code is as:</p>
  
  <pre><code>$.fn.loginSubmit = function(e) {
      e.preventDefault();
      // my whole functionality
      };
  </code></pre>
  
  <p>Please tell me what is wrong with this code and suggest me if I am doing something wrong. I am newbee in testing frontend javascript.</p>