Guest User

Untitled

a guest
Jan 19th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. beforeEach(() => {
  2. fixture = TestBed.createComponent(AddMonsterComponent);
  3. component = fixture.componentInstance;
  4. fixture.detectChanges();
  5. });
  6.  
  7. describe('save button', () => {
  8.  
  9. it('is enabled when the form is in a valid state', async(() => {
  10.  
  11. expect(component.addMonsterForm.valid).toBeFalsy();
  12.  
  13. const button = fixture.nativeElement.querySelector('#addMonsterButton');
  14. expect(button.disabled).toBeTruthy();
  15.  
  16. // fill out form correctly
  17. enterValidInputs();
  18.  
  19. // trigger changes
  20. fixture.detectChanges();
  21.  
  22. fixture.whenStable().then(() => {
  23.  
  24. expect(component.addMonsterForm.valid).toBeTruthy();
  25.  
  26. // expect 'save' button to be enabled
  27. const button = fixture.nativeElement.querySelector('#addMonsterButton');
  28. expect(button.disabled).toBeFalsy();
  29. });
  30.  
  31. }));
  32. });
Add Comment
Please, Sign In to add comment