weather应用程序的angularjs单元测试用例

v9tzhpje  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(253)

如何为bellow控制器编写单元测试用例。我对angularjs完全陌生,我必须解决这个问题。请引导我

  1. angular.module('ourAppApp')
  2. .controller('MainCtrl', function($scope,apiFac) {
  3. $scope.displayCity = false;
  4. $scope.displayWeather = false;
  5. $scope.today = new Date();
  6. $scope.searchCity = function(){
  7. if($scope.cityInput != ""){
  8. apiFac.searchCity($scope.cityInput).then(function(response){
  9. $scope.searchResponse = response;
  10. $scope.displayCity = true;
  11. })
  12. }
  13. }
  14. $scope.getcitydetails = function(item){
  15. $scope.cityInput = "";
  16. $scope.displayCity = false;
  17. $scope.selectedCity = item;
  18. apiFac.weatherReport(item.woeid).then(function(response){
  19. $scope.weatherResponse = response;
  20. $scope.displayCity = false;
  21. $scope.displayWeather = true;
  22. })
  23. }
  24. })

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题