我会抛出这个错误:
Error: Error: [$parse:isecwindow] Referencing the Window in Angular expressions is disallowed当我尝试使用$window.open/window.open in angularjs时。button" class="btn btn-primary" ng-click="vm.downloadFile('csv')"&g
我需要测试一个在浏览器中打开一个新标签的函数 window.open(`a_url_${contactIds}`);我想模拟窗口的open函数,这样我就可以验证传递给open函数的URL是否正确。使用Jest,我不知道如何模拟window。我试图用一个模拟函数来设置window.open,但是这种方法不起作用。下面是测试用例
it('correct url is called
我试图覆盖window.open(),所以我试图找到一种在没有window.open()的新窗口中打开链接的方法。唯一的方法是重写window.open()。例如,当我想打开顶部窗口中的链接时,我会像这样覆盖window.open(): return function (url, namePS:我不能在这里使用锚,因为我正在重写