首页 > 解决方案 > 天气应用程序的Angularjs单元测试用例

问题描述

如何为波纹管控制器编写单元测试用例。我对 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;
      })
    }


})

标签: angularjsunit-testingjasmine

解决方案


推荐阅读