I have a function in JS view which performs some action if the window width is less than 1000. I'm attempting to write unit tests for this with Mocha, chai and running the tests via karma test runner in Phantom/Chrome/Chromium browser.
I also use sinon to stub the methods and making it to return some desired value. Now there is a condition check where if the window width is less than 1000 so how can i stub this, i was trying something like below,
sinon.stub($(window).width()); $(window).width().returns(900);
but it is not working. Is there any specific way where i can stub window.width value?
Aucun commentaire:
Enregistrer un commentaire