Skip to main content

angular-test

登入沒有登入的情況

const auth: AuthInfo = {
roles: [''],
config: { user: { id: '777' }, supplier: { status: '' } },
};

authService.auth$.next(auth);

設定一個 form 的 test

// when footer submit subscribe mail
function submitForm(email) {
component.subscribeForm.form.controls['email'].setValue(email);
component.subscribeForm.form.controls['terms'].setValue(true);
}

it('submit empty form', () => {
...
// 先把 formGroup 裡的值寫入值,在去 call 這個 function
submitForm(email);
component.submitForm();
...
});