Birim test için çok yeni. NgDialouge kullanan bir açısal servisim var - bu 2 radyo düğmesinin Evet/Hayır.Yasemin Karma ile ngDialogue için Evet/Hayır kararını alay Nasıl
angular.module('jasminKarmaPoc1App')
.factory('fateLayingService', fateLayingService);
.....
var response = {}
response.AvoidPayment = function (playerDetails){
....
var prom = ngDialog.open(
{
template: 'scripts/decisionbox/fate-decision- modal-window.html',
controller: 'DecisionBoxController'
}
);
prom.closePromise.then(function (res) {
if (res.value === "1")
{
//***Below is the one I want to test -i.e. alert and updation of scope ****
//alert the message and update some related scope variables login
}
if (res.value === "2")
{
//**Below is the one I want to test -i.e. alert and updation of scope
//alert the message and update some related scope variables login
}
.....
return response()
Şimdi birim test mesajları ve scope.msg diyalog kutusu seçimine bağlı olarak güncellenen var mı testine istiyorum (Evet farklı msj verir ve No farklı msj verir). Eğer bu mesajları test etmek istersem, ngDialog ile seçimlerini yapmam gerekiyor (Evet/Hayır), ama tam olarak nasıl yapılacağı konusunda kafam karıştı. Herhangi bir yardım takdir edilecektir.
http://jasmine.github.io/2.0/introduction.html#section-Spies:_
and.callFake
size yardımcı olabilir bu. NgDialog ile çok aşina değil, ama casus kullanarak işlevi alay etmek muhtemelen işe yarayabilir. – TheyCallMeSamBağlantı için teşekkürler – user2869612