Created
March 22, 2019 15:26
-
-
Save marcel-ploch/72e9b3f388e284e51a2858b85bf77256 to your computer and use it in GitHub Desktop.
Test mit Selektoren und Spy's
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 edit an element via button click', async(() => { | |
fixture.detectChanges(); | |
const compiled = fixture.debugElement.nativeElement; | |
let matCards = compiled.querySelectorAll('mat-card'); | |
expect(app.toDoList.length).toBe(matCards.length); | |
spyOn(app, 'openDialogEdit').and.callFake(() => { | |
app.editItem(1, {name: 'Edit'}); | |
}); | |
const deleteElement = compiled.querySelectorAll('button.edit'); | |
deleteElement[0].click(); | |
fixture.detectChanges(); | |
fixture.whenStable().then(() => { | |
matCards = compiled.querySelectorAll('mat-card'); | |
expect(4).toBe(matCards.length); | |
}); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment