Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save advorkina/a12f3bef3172b3a76692d42f91ed1d3e to your computer and use it in GitHub Desktop.
Save advorkina/a12f3bef3172b3a76692d42f91ed1d3e to your computer and use it in GitHub Desktop.
it("should emit folder with the new title on Enter key", fakeAsync(() => {
// arrange
spyOn(component.folderUpdated, "emit");
// act
let inlineEditInputDebugElement: DebugElement = fixture.debugElement.query(
By.css("custom-inline-edit #title-input"));
let inlineEditInputElement: any = editDescriptionElement.nativeElement;
inlineEditInputElement.value = "Albus Dumbledore";
inlineEditInputElement.dispatchEvent(new Event("input"));
inlineEditInputDebugElement.triggerEventHandler("keydown.enter", null);
fixture.detectChanges();
// assert
let emittedFolder: IFolder = (component.folderUpdated.emit as any).calls.mostRecent().args[0];
expect(emittedFolder.title).toEqual("Albus Dumbledore");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment