jeudi 13 novembre 2014

How to write the Jasmine unit test case for IFrame


Vote count:

0




As I am writing angularJS Jasmine test case for iframe print, but it showing "Cannot read property 'open' of undefined". Please find below the snippet of the code



Source code:

$scope.print = function() {
var iFrame = document.getElementById("printingFrame");
var iFrameDoc = iFrame.contentDocument;
iFrameDoc.open();
var contents = "text";
iFrameDoc.write(contents);
iFrameDoc.close();
iFrame.contentWindow.focus();
iFrame.contentWindow.print();
};

Test Case:

describe("just a test", function () {
it("should print iframe content", function () {
locals.$scope.print();
});
});

Error:

TypeError: Cannot read property 'open' of undefined


Anyone know why the following unit test does not pass?



asked 1 min ago







How to write the Jasmine unit test case for IFrame

Aucun commentaire:

Enregistrer un commentaire