我正在使用Angular JS 1. *,并使用Jasmine编写单元测试。
<PackageReference Include="StyleCop.Analyzers" Version="1.0.0" PrivateAssets="All" Condition="%(!FileName.Contains('bla.csproj'))" />
此// buildCtrl() and stuff
ctrl.newPostText = 'My post';
ctrl.submitNewPost();
timeout.flush(); // if I delete this line ctrl.postSubmitting = false
// but there's no timeout at least
expect(ctrl.postSubmitting).toBe(true);
基本上会启动一个确认submitNewPost
,我正在测试中对其进行嘲笑:
mdDialog
您有任何想法如何调试(检查该队列任务)?我可以用什么代替 mdDialogMock = jasmine.createSpyObj('mdDialog', ['confirm', 'show']);
mdDialogMock.show.and.returnValue(q.when(true));
mdConfirmDialogMock = jasmine.createSpyObj('mdDialog', [
'title',
'textContent',
'ok',
'cancel',
]);
mdConfirmDialogMock.title.and.returnValue(mdConfirmDialogMock);
使其起作用?
谢谢!