So I have this function which is called when some backbone model attribute is set. I.e:
this.listenTo(model, "change:someattr", changeCallback);
What I want to do in my Jasmine tests is to set this attribute and then check if changeCallback
got called successfully and if it resulted in desired changes. In my code below it looks like my changeCallback
function gets called after jasmine assertions are executed.
that.model.set('someattr', 'xyz');
expect(that.model.changeCallback).toHaveBeenCalled();
Any ideas how to test this? All code examples I've found deal with asych calls which are executed directly on asynchronous function.
Aucun commentaire:
Enregistrer un commentaire