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

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

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

angular.module('ourAppApp')
.controller('MainCtrl', function($scope,apiFac) {

    $scope.displayCity = false;
    $scope.displayWeather = false;
    $scope.today = new Date();
    $scope.searchCity = function(){

        if($scope.cityInput != ""){ 
          apiFac.searchCity($scope.cityInput).then(function(response){
            $scope.searchResponse = response;
            $scope.displayCity = true;
          })
        }   
    }

    $scope.getcitydetails = function(item){
      $scope.cityInput = "";
      $scope.displayCity = false;
      $scope.selectedCity = item;

      apiFac.weatherReport(item.woeid).then(function(response){
        $scope.weatherResponse = response;
        $scope.displayCity = false;
        $scope.displayWeather = true;
      })
    }

})

暂无答案!

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

相关问题