This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("selectFolder", () => { | |
it("should update selectedFolder property with passed folder", () => { | |
// arrange | |
component.selectedFolder = undefined; | |
let folder: IFolder = new Folder(1, "Harry Potter"); | |
// act | |
component.selectFolder(folder); | |
// assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public selectFolder(folder: IFolder): void { | |
this.selectedFolder = folder; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public editTitleConfirmed(title: string): void { | |
if (!title) { | |
return; | |
} | |
this.folderUpdated.emit({ ...this.folder, title: title }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span *ngIf="folder" class="folder-name"> | |
<custom-inline-edit [text]="folderTitle" | |
(editConfirmed)="editTitleConfirmed($event)" | |
(canceled)="editFolderCanceled.emit($event)"> | |
</custom-inline-edit> | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("should set input property 'text' equal to folder title in <custom-inline-edit/>", () => { | |
// arrange | |
component.folder = folder; | |
fixture.detectChanges(); | |
// act | |
let inlineEditElement: DebugElement = editDescriptionElement = fixture.debugElement.query( | |
By.css("custom-inline-edit")); | |
// assert |
NewerOlder