我有以下模态组件代码
public static void remove(Collection coll, Predicate pred) {
Iterator iterator = coll.iterator();
while (iterator.hasNext()) {
if (pred.test(iterator.next())) {
iterator.remove();
}
}
}
要打开上述模式,请使用
angular.module('components')
.component('modal', {
bindings:{
modalInstance: '<',
resolve: '=',
dismiss: '&',
close: '&'
},
controller: controller,
templateUrl: 'template.html'
});
controller.$inject = [];
function controller() {
var ctrl = this;
ctrl.closeModal = closeModal;
ctrl.$onInit = function(){
};
ctrl.modalInstance.rendered.then(function(){
testFunction();
});
}
该模式可以正常工作,但是我的问题在于单元测试。当我尝试对其进行单元测试时,我得到
$uibModal.open({
component: 'modal',
backdrop: 'static'
});
我尝试使用以下代码进行测试
TypeError: undefined is not a function (evaluating 'ctrl.modalInstance.rendered.then