Skip to content
Snippets Groups Projects
Commit 0d04470c authored by fsdavid's avatar fsdavid
Browse files

Fix status card test error

parent 4e2f3c7d
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ import { viewerConfigSelectorUseMobileUi } from "src/services/state/viewerConfig ...@@ -16,6 +16,7 @@ import { viewerConfigSelectorUseMobileUi } from "src/services/state/viewerConfig
import { viewerStateNavigationStateSelector, viewerStateSelectedTemplatePureSelector } from "src/services/state/viewerState/selectors" import { viewerStateNavigationStateSelector, viewerStateSelectedTemplatePureSelector } from "src/services/state/viewerState/selectors"
import * as util from '../util' import * as util from '../util'
import { viewerStateChangeNavigation } from "src/services/state/viewerState/actions" import { viewerStateChangeNavigation } from "src/services/state/viewerState/actions"
import {QuickTourModule} from "src/ui/quickTour/module";
@Directive({ @Directive({
selector: '[iav-auth-auth-state]', selector: '[iav-auth-auth-state]',
...@@ -46,6 +47,7 @@ describe('> statusCard.component.ts', () => { ...@@ -46,6 +47,7 @@ describe('> statusCard.component.ts', () => {
ReactiveFormsModule, ReactiveFormsModule,
NoopAnimationsModule, NoopAnimationsModule,
UtilModule, UtilModule,
QuickTourModule
], ],
declarations: [ declarations: [
StatusCardComponent, StatusCardComponent,
...@@ -88,13 +90,13 @@ describe('> statusCard.component.ts', () => { ...@@ -88,13 +90,13 @@ describe('> statusCard.component.ts', () => {
}) })
it('> toggle can be found', () => { it('> toggle can be found', () => {
const slider = fixture.debugElement.query( By.directive(MatSlideToggle) ) const slider = fixture.debugElement.query( By.directive(MatSlideToggle) )
expect(slider).toBeTruthy() expect(slider).toBeTruthy()
}) })
it('> toggling voxel/real toggle also toggles statusPanelRealSpace flag', () => { it('> toggling voxel/real toggle also toggles statusPanelRealSpace flag', () => {
const prevFlag = fixture.componentInstance.statusPanelRealSpace const prevFlag = fixture.componentInstance.statusPanelRealSpace
const sliderEl = fixture.debugElement.query( By.directive(MatSlideToggle) ) const sliderEl = fixture.debugElement.query( By.directive(MatSlideToggle) )
const slider = sliderEl.injector.get(MatSlideToggle) const slider = sliderEl.injector.get(MatSlideToggle)
...@@ -102,21 +104,21 @@ describe('> statusCard.component.ts', () => { ...@@ -102,21 +104,21 @@ describe('> statusCard.component.ts', () => {
fixture.detectChanges() fixture.detectChanges()
expect(fixture.componentInstance.statusPanelRealSpace).toEqual(!prevFlag) expect(fixture.componentInstance.statusPanelRealSpace).toEqual(!prevFlag)
}) })
describe('> textNavigationTo', () => { describe('> textNavigationTo', () => {
it('> takes into account of statusPanelRealSpace panel', () => { it('> takes into account of statusPanelRealSpace panel', () => {
const setNavigationStateSpy = jasmine.createSpy('setNavigationState') const setNavigationStateSpy = jasmine.createSpy('setNavigationState')
fixture.componentInstance.nehubaViewer = { fixture.componentInstance.nehubaViewer = {
setNavigationState: setNavigationStateSpy, setNavigationState: setNavigationStateSpy,
} as any } as any
fixture.componentInstance.statusPanelRealSpace = true fixture.componentInstance.statusPanelRealSpace = true
fixture.componentInstance.textNavigateTo('1, 0, 0') fixture.componentInstance.textNavigateTo('1, 0, 0')
expect(setNavigationStateSpy).toHaveBeenCalledWith({ expect(setNavigationStateSpy).toHaveBeenCalledWith({
position: [1e6, 0, 0], position: [1e6, 0, 0],
positionReal: true positionReal: true
}) })
fixture.componentInstance.statusPanelRealSpace = false fixture.componentInstance.statusPanelRealSpace = false
fixture.componentInstance.textNavigateTo('1, 0, 0') fixture.componentInstance.textNavigateTo('1, 0, 0')
expect(setNavigationStateSpy).toHaveBeenCalledWith({ expect(setNavigationStateSpy).toHaveBeenCalledWith({
...@@ -152,9 +154,9 @@ describe('> statusCard.component.ts', () => { ...@@ -152,9 +154,9 @@ describe('> statusCard.component.ts', () => {
const mockStore = TestBed.inject(MockStore) const mockStore = TestBed.inject(MockStore)
mockStore.overrideSelector(viewerStateSelectedTemplatePureSelector, mockTemplate) mockStore.overrideSelector(viewerStateSelectedTemplatePureSelector, mockTemplate)
mockStore.overrideSelector(viewerStateNavigationStateSelector, mockCurrNavigation) mockStore.overrideSelector(viewerStateNavigationStateSelector, mockCurrNavigation)
spyOnProperty(util, 'getNavigationStateFromConfig').and.returnValue(getNavigationStateFromConfigSpy) spyOnProperty(util, 'getNavigationStateFromConfig').and.returnValue(getNavigationStateFromConfigSpy)
fixture = TestBed.createComponent(StatusCardComponent) fixture = TestBed.createComponent(StatusCardComponent)
fixture.detectChanges() fixture.detectChanges()
fixture.componentInstance.showFull = true fixture.componentInstance.showFull = true
...@@ -176,7 +178,7 @@ describe('> statusCard.component.ts', () => { ...@@ -176,7 +178,7 @@ describe('> statusCard.component.ts', () => {
const idspatchSpy = spyOn(mockStore, 'dispatch') const idspatchSpy = spyOn(mockStore, 'dispatch')
fixture.componentInstance.resetNavigation({ [method]: true, }) fixture.componentInstance.resetNavigation({ [method]: true, })
fixture.detectChanges() fixture.detectChanges()
const overrideObj = {} const overrideObj = {}
if (method === 'rotation') overrideObj['orientation'] = mockNavState['orientation'] if (method === 'rotation') overrideObj['orientation'] = mockNavState['orientation']
if (method === 'position') overrideObj['position'] = mockNavState['position'] if (method === 'position') overrideObj['position'] = mockNavState['position']
...@@ -195,7 +197,7 @@ describe('> statusCard.component.ts', () => { ...@@ -195,7 +197,7 @@ describe('> statusCard.component.ts', () => {
}) })
} }
}) })
}) })
}) })
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment