javascript - How to mock $(element).show and ko.mapping.fromJS in jasmine test case? -
here code:
testviewmodel.prototype.edit = function(pid, pdata) { self.modalid = '#header'; $(self.modalid).modal('show'); //error self.id(ko.mapping.fromjs(pdata).id()); //how mock ? }
this jasmine test case:
it("calling edit method", function() { var modalid = $("#cc-accesscontrolusermodal"); var editdata = {id:"i10060"}; spyon($.fn, 'modal'); self.testviewmodel.edit("i10060",editdata); });
however, give me:
error: modal() method not exist
so, question is: how mock $(element).show
, ko.mapping.fromjs
in jasmine test case?
javascript knockout.js jasmine
No comments:
Post a Comment