2017-01-11 12 views
0

最近、Angularアプリケーションを1.5.8から1.6.1に更新しました。 テストでは、$ httpBackend.flush()はルートの変更を開始し、イベントをリッスンしている関数の呼び出しを開始した '$ routeChangeStart'メッセージをブロードキャストします。

移行中に何か不足していますか?

//Function listening to the $routeChangeStart 
$rootScope.$on("$routeChangeStart", function (event, next) { 
    console.log('This is called'); 
}); 

//Test 
describe('Testing', function() { 
    it.only('Testing', function() { 
    //Code 
    $httpBackend.when('GET', endpoints.endpoint1).respond([]); 
    $httpBackend.flush(); 

    }); 
}); 
+0

@Codesinghが、それはどのような違いを生むん – Codesingh

+0

を共有してください! $ httpBackend.flush()はルート変更を呼び出しています。 – Sabby62

答えて

0

これを追加してください:あなたのテストで$httpBackend.whenGET('url').respond(200, { data: "ok"});

+0

を共有コード – Sabby62

関連する問題