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();
+ });
});