Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active June 27, 2018 04:01
Show Gist options
  • Select an option

  • Save cartant/873d89b5b43c7d549e4d5cd384742a37 to your computer and use it in GitHub Desktop.

Select an option

Save cartant/873d89b5b43c7d549e4d5cd384742a37 to your computer and use it in GitHub Desktop.
it('should indicate when searching', fakeSchedulers(() => {
const fixture = TestBed.createComponent(SomeComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
const input = compiled.querySelector('input');
expect(compiled.querySelector('.searching')).toBeNull();
fixture.componentInstance.form.patchValue({ term: 'foo' });
fixture.detectChanges();
expect(compiled.querySelector('.searching')).toBeNull();
tick(400);
fixture.detectChanges();
expect(compiled.querySelector('.searching')).not.toBeNull();
expect(compiled.querySelector('.searching span').textContent).toMatch(/foo/);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment