考虑以下功能:
function redirect() {
if (BrowserDetect.isIE()) {
window.history.pushState({}, 'Going to', location.href);
var referLink = document.createElement('a');
referLink.href = surveyReviewUrl;
document.body.appendChild(referLink);
referLink.click();
}
}
我的代码(测试用例):
it('tests redirecting to logical survey using IE ',function () {
spyOn(BrowserDetect, 'isIE').and.callFake(function () {
return true;
});
scope.redirect();
});
这会提示以下错误:
您的某些测试重新加载了整页!
有人可以告诉我如何为上述功能编写测试用例吗?