Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(editor): zooming options will be highlighted (#255)
- Loading branch information
1 parent
5a04c82
commit 7abb9f5
Showing
3 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,74 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { async, TestBed } from '@angular/core/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { MatMenuModule } from '@angular/material/menu'; | ||
import { XStore } from '@app/core/state/state.mock'; | ||
import { MatSnackBarModule } from '@angular/material/snack-bar'; | ||
import { UiState } from '@app/core/state'; | ||
import { WINDOW_PROVIDERS } from '@app/core/window.service'; | ||
import { NgxsModule } from '@ngxs/store'; | ||
import { EditorComponent } from './editor.component'; | ||
|
||
describe('EditorComponent', () => { | ||
beforeEach(async(() => { | ||
let fixture: ComponentFixture<EditorComponent>; | ||
let component: EditorComponent; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
schemas: [NO_ERRORS_SCHEMA], | ||
imports: [MatMenuModule, NgxsModule.forRoot([XStore])], | ||
imports: [MatMenuModule, MatSnackBarModule, NgxsModule.forRoot([UiState])], | ||
declarations: [EditorComponent], | ||
providers: [WINDOW_PROVIDERS] | ||
}).compileComponents(); | ||
})); | ||
it('should create the app', async(() => { | ||
const fixture = TestBed.createComponent(EditorComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app).toBeTruthy(); | ||
})); | ||
|
||
jest.useFakeTimers(); | ||
fixture = TestBed.createComponent(EditorComponent); | ||
component = fixture.debugElement.componentInstance; | ||
jest.setTimeout(10); | ||
|
||
}); | ||
|
||
it('should create the component', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should set zoom in highlight option when zoomed in', () => { | ||
fixture.detectChanges(); | ||
expect(component.zoomIn).toBeFalsy(); | ||
component.ZoomIn(); | ||
expect(component.zoomIn).toBeTruthy(); | ||
}); | ||
|
||
it('should unset zoom in highlight option when below our on reset level', () => { | ||
fixture.detectChanges(); | ||
component.ZoomIn(); | ||
component.ZoomIn(); | ||
expect(component.zoomIn).toBeTruthy(); | ||
component.ZoomReset(); | ||
expect(component.zoomIn).toBeFalsy(); | ||
}); | ||
|
||
it('should set zoom out highlight option when zoomed out', () => { | ||
fixture.detectChanges(); | ||
expect(component.zoomOut).toBeFalsy(); | ||
component.ZoomOut(); | ||
expect(component.zoomOut).toBeTruthy(); | ||
}); | ||
|
||
it('should unset zoom out highlighting option when above our on reset level', () => { | ||
fixture.detectChanges(); | ||
component.ZoomOut(); | ||
component.ZoomOut(); | ||
expect(component.zoomOut).toBeTruthy(); | ||
component.ZoomReset(); | ||
expect(component.zoomOut).toBeFalsy(); | ||
}); | ||
|
||
|
||
it('should unset highlighting options when we are on reset level', () => { | ||
component.zoomIn = true; | ||
component.zoomOut = true; | ||
fixture.detectChanges(); | ||
component.ZoomReset(); | ||
expect(component.zoomOut).toBeFalsy(); | ||
expect(component.zoomIn).toBeFalsy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters