$scope.$watch('hb.bulkPromise', function (promise) {
promise.then(function (resource) {
return resource.test();
}).then(function (data){
})
}
我的角度指令中有一个带有诺言的结构。 我们怎样才能为上述承诺编写测试。
答案 0 :(得分:0)
当您调用$ scope。$ digest()时,单元测试Angular, 所有 承诺将被触发完成。时间由你决定。基本步骤:
答案 1 :(得分:0)
假设您正在使用jasmine testing framework。
我相信你需要在页面的中间部分模仿类似于what is done here的承诺..