View Full Version : Jasmine Unit Testing a MVC controller  2 Apr
2012, 5:10 AM I am trying to unit test a MVC controller using
Jasmine and having trouble getting the controller to detect a
fireEvent.  The test spec:  it("has invoked the login callback",
function() { spyOn(this.controller, 'onLogin').andReturn(true);
var login_btn =
this.controller.getLoginform().down('#LoginButton');   The
controller has the following listener setup:  init:
function(application_instance) { // Handle events fired from
views controlled by this controller. '#LoginButton': { click:
this.onLogin  Any help iin getting this working would be
appreciated.  2 Apr 2012, 5:52 AM I have figured out that the
event is being detected, but Jasmine is not detecting that
onLogin is being called! If I create a spy for onLogin, Jasmine
still does not detect it!  //spyOn(this.controller,
'onLogin').andReturn(true); this.controller.onLogin =
jasmine.createSpy("Login Spy").andCallFake(function() {
console.log("Fake onLogin called");  console.log("Ab