我正在尝试为茉莉花编写8号单元测试用例。我的表格如下:
<form ngNoForm method="post" [action]="url" name="redirect" #redirectForm>
<input type= "hidden" name="mesgFromBank" value="{{message}}">
</form>
我的ts文件看起来像这样:
@ViewChild('redirectForm', { read: ElementRef, static: false }) redirectForm: ElementRef;
this.redirectForm.nativeElement.action = this.url;
this.redirectForm.nativeElement.firstChild.value = this.message;
this.redirectForm.nativeElement.submit();
但是,我尝试编写测试用例时,它将重定向到this.url
并最终崩溃,并且在浏览器的Karma运行程序中看到"NOT FOUND"
。
有人可以帮我吗?
谢谢。