我正在编写用angularJS指令编写的代码的jasmine单元测试用例。以下是代码:想要在angularjs代码中为addEventListener编写jasmine单元测试用例
document.getElementById(scope.elementID).addEventListener('focus', function(e) {
$rootScope.isGoogleLocationProgress = true;
// destinationReady = true;
});
document.getElementById(scope.elementID).addEventListener('keydown', function(e) {
$rootScope.isGoogleLocationProgress = true;
// destinationReady = false;
});
document.getElementById(scope.elementID).addEventListener('blur', function(e) {
$document.on('click', checkForClearClick);
function checkForClearClick(e) {
if (e.target) {
if (e.target.name != "clearSearch") {
$timeout(getLocationPrediction, 0);
}
}
}
});
请帮我把它添加
StackOverflow不是为您编写代码,而是关于如何帮助您编写代码。试试看,如果你需要的话,请阅读如何测试茉莉花/角度,如果你对自己写的东西有问题,请回来。有关如何编写好问题的更多建议,请参阅: https://stackoverflow.com/help/how-to-ask –