【发布时间】:2017-02-06 15:59:25
【问题描述】:
当我遇到这个奇怪的问题时,我正在编写测试代码。如果我在执行myModal.dismiss(); 之后执行$rootScope.$digest();,我会得到Possibly unhandled rejection: undefined thrown。我查看了 angular-bootstrap 库中 Modal 的单元测试,我注意到他们正在使用 $animate 做一些事情。也许这有关系?
it('tests weird failure', function(){
var myModal = this.$uibModal.open({
template: '<div class="modalTwo"></div>',
size: "md"
});
this.$rootScope.$digest();
myModal.dismiss();
this.$rootScope.$digest();
});
【问题讨论】:
标签: angularjs angular-bootstrap