I am writing test, which expects to store new form.value in localStorage. By now I need to find out how to update form.value. Here is my code:
it('should remember form values and store them in localStorage', fakeAsync(() => {
let lsService: LocalStorageService = fixture.debugElement.injector.get(LocalStorageService);
console.log(component.filterForm.value);
tick();
fakeCheck('[name="notFullyLoaded"]');
fixture.detectChanges();
console.log(component.filterForm.value);
}));
function fakeCheck(selector: string) {
fixture.detectChanges();
tick();
let input = fixture.debugElement.query(By.css(selector)).nativeElement;
input.checked = true;
tick();
}
Aucun commentaire:
Enregistrer un commentaire