From: Bastian Dehn Date: Sat, 2 Jul 2022 21:07:37 +0000 (+0200) Subject: add: tests for food component X-Git-Tag: v1.0.7^2~8 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=ad004f59706d683c105ad61a3302c5ebf38affd1;p=speisekarten-editor.git add: tests for food component --- diff --git a/src/app/food/food.component.spec.ts b/src/app/food/food.component.spec.ts index c4aa61d..5cef7ad 100644 --- a/src/app/food/food.component.spec.ts +++ b/src/app/food/food.component.spec.ts @@ -23,4 +23,27 @@ describe('FoodComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('form is visible by init', () => { + expect(component.formFoodVisible).toBeTruthy(); + }); + + it('edit forms visible for edit', () => { + component.formFoodVisible = false; + component.editFood(); + expect(component.formFoodVisible).toBeTruthy(); + }); + + it('edit forms not visible after save', () => { + component.formFoodVisible = true; + component.saveFood(); + expect(component.formFoodVisible).toBeFalsy(); + }); + + it('edit forms not visible after save with enter', () => { + component.formFoodVisible = true; + let key = { keyCode: 13 }; + component.onKeypressEnter(key); + expect(component.formFoodVisible).toBeFalsy(); + }); });