Naleag Deco
unread,Nov 22, 2010, 6:53:11 PM11/22/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jasmine-webos
I'm seeing some weird behaviour when trying to spy on listen/
stopListening calls.
My spec looks something like ... (I apologize for spelling mistakes)
var assistant;
beforeEach(function () {
assistant =
jasmine.webos.createStubSceneAssistant('TestView', arg);
});
it('should pass this test', function() {
spyOn(assistant.controller, 'listen');
spyOn(assistant.controller, 'stopListening');
assistant.setup();
expect(assistant.controller.listen).toHaveBeenCalledWith("an_element_id",
Mojo.Event.listTap,
assistant.a_function.bindAsEventListener(assistant));
...
});
My scene's setup function contains a call to
"this.controller.listen("an_element_id", Mojo.Event.listTap,
this.a_function.bindAsEventListener(this));" and there is a similar
call in my cleanup code.
The code appears to work, but Jasmine reports an error similar to:
"Expected spy to have been called with ['an_element_id', 'mojo-list-
tap', Function ] but was called with [['story_list, 'mojo-list-tap',
Function ]]"
I am unable to figure out why the "real" function call in Jasmine
winds up being wrapped in another array, and whether that's what
happens in production code or just via the framework. I have tried
playing with Mojo.Event.listen/stopListening and with using bind
instead of bindAsEventListener.
Is there a better way to test these calls?