mercredi 21 janvier 2015

jasmine - spy property into jquery.post callback

With Jasmine. I'm trying to assert if a property changed after a $.post, I mean in it's callback.


$.post(x,x,function(){ boolean = true; <--- need to assert this })


Because I don't really want my tests to be coupled to $ I can spyOn, something like.


spyOn($,'post')


This works BUT I'm overwriting my original callback and my boolean will never be change.


I could use ".CallThrough" but I don't want the REALLY do the post, it's a test.


Any idea how to solve it? I'm thinking it wrong ?


Thanks !!!


Aucun commentaire:

Enregistrer un commentaire