Skip to content

Commit

Permalink
Fix frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lkleisa committed Dec 8, 2023
1 parent fb0e394 commit dc70125
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ describe('CompleteDialogComponent', () => {
});

it('should set right classes on init', () => {
let elements = document.querySelectorAll('.card-hover');
let elements = document.querySelectorAll('.valuation-card');
let successful = document.querySelectorAll('.card-hover-successful');
let notSuccessful = document.querySelectorAll('.card-hover-not-successful');
let submitButton = document.querySelectorAll('button')[1];

expect(elements.length).toEqual(2);
expect(successful.length).toEqual(1);
expect(notSuccessful.length).toEqual(1);
expect(component.completeForm.value.isSuccessful).toBeNull();
expect(component.completeForm.value.comment).toBeNull();
expect(component.completeForm.invalid).toBeTruthy();
Expand Down Expand Up @@ -70,15 +74,15 @@ describe('CompleteDialogComponent', () => {
it('should set active and non-active classes on switch', () => {
component.switchSuccessState('successful');
fixture.detectChanges();
let nonActiveElement = document.querySelector('.non-active');
let nonActiveElement = document.querySelector('.active');

expect(nonActiveElement!.innerHTML).toContain('Objective nicht erreicht');
expect(nonActiveElement!.innerHTML).toContain('Objective erreicht');

component.switchSuccessState('notSuccessful');
fixture.detectChanges();
nonActiveElement = document.querySelector('.non-active');
nonActiveElement = document.querySelector('.active');

expect(nonActiveElement!.innerHTML).toContain('Objective erreicht');
expect(nonActiveElement!.innerHTML).toContain('Objective nicht erreicht');
});

it('should close dialog with right data', () => {
Expand Down

0 comments on commit dc70125

Please sign in to comment.