Skip to content

Commit

Permalink
test(unit): refactory expect darkmode
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasferreiralimax committed Nov 3, 2022
1 parent ffa307a commit 962da1b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/app/components/darkmode/darkmode.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ describe('DarkmodeComponent', () => {
it('should create', async () => {
expect(component).toBeTruthy();
});
it('should light mode', fakeAsync(async () => {
it('should light and dark mode', fakeAsync(() => {
const btnMode = fixture.debugElement.query(By.css('.btn-mode')).nativeElement

expect(modeButton()).toBe('LightMode');
expect(buttonIcon('[aria-label="Icon Light Mode"]')).toBeTruthy();
}));
it('should dark mode', fakeAsync(async () => {
fixture.detectChanges();
tick();

const btnMode = fixture.debugElement.query(By.css('.btn-mode')).nativeElement
btnMode.dispatchEvent(new Event('click'));

tick();

expect(modeButton()).toBe('DarkMode');
expect(buttonIcon('[aria-label="Icon Dark Mode"]')).toBeTruthy();
}));
Expand Down

0 comments on commit 962da1b

Please sign in to comment.