Skip to content

Instantly share code, notes, and snippets.

@advorkina
Last active December 4, 2019 17:24
Show Gist options
  • Save advorkina/47c2e7a763531c514687c06b631cfd81 to your computer and use it in GitHub Desktop.
Save advorkina/47c2e7a763531c514687c06b631cfd81 to your computer and use it in GitHub Desktop.
Testing Output() event
it("should emit folder with the new title on editTitleConfiremd", () => {
// arrange
component.folder.title = "Harry Potter";
fixture.detectChanges();
spyOn(component.folderUpdated, "emit");
// act
let inlineEditElement: DebugElement = editDescriptionElement = fixture.debugElement.query(
By.css("custom-inline-edit"));
inlineEditElement.triggerEventHandler("editConfirmed", "Albus Dumbledore");
// assert
let emittedFolder: IFolder = component.folderUpdated.emit.calls.mostRecent().args[0];
expect(emittedFolder.title).toEqual("Albus Dumbledore");
});
@derekkrause
Copy link

editTitleConfiremd should read editTitleConfirmed

great test example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment