diff --git a/Dockerfile b/Dockerfile index 3b017144535e201d255259c3b28ec4833d965e0c..14bfaf866d6b8db773443eebc37b32f54300432d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN npm i RUN npm run build-aot # gzipping container -FROM ubuntu:20.10 as compressor +FROM ubuntu:22.04 as compressor RUN apt upgrade -y && apt update && apt install brotli RUN mkdir /iv diff --git a/angular.json b/angular.json index 68b6001b6a2bd6b197221bcf374c11f378bff086..7d4fcb6a0e5a971095069f821056fcfab9ea3679 100644 --- a/angular.json +++ b/angular.json @@ -29,7 +29,6 @@ "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "css", "assets": [ - "src/favicon.ico", "src/assets" ], "styles": [ @@ -60,7 +59,11 @@ "inject": false, "bundleName": "syntaxError" }, - + { + "input": "third_party/extra_js.js", + "inject": false, + "bundleName": "extra_js" + }, { "input": "third_party/vanilla_nehuba.js", "inject": false, diff --git a/docs/releases/v2.6.2.md b/docs/releases/v2.6.2.md new file mode 100644 index 0000000000000000000000000000000000000000..9d9b9979bbdbdea7186d7c4f47d657de13a50bd8 --- /dev/null +++ b/docs/releases/v2.6.2.md @@ -0,0 +1,14 @@ +# v2.6.2 + +## Bugfixes + +- Added indication when annotations were overwritten (partial fix to #1128) + +## Under the hood stuff + +- fixed some CSP issues +- fixed favicons +- added build debug messages +- increment siibra-api version expectation +- remove unused tests +- update compressor image to 22.04 diff --git a/mkdocs.yml b/mkdocs.yml index c241c4687813d1dae9989a231ac606140e24f39a..01b07eb3b9759e89e7fe1fb66ec0b143a1b97c04 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,6 +40,7 @@ pages: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.6.2: 'releases/v2.6.2.md' - v2.6.1: 'releases/v2.6.1.md' - v2.6.0: 'releases/v2.6.0.md' - v2.5.8: 'releases/v2.5.8.md' diff --git a/package-lock.json b/package-lock.json index 0d10510326d468f9571ed0ab12e43a0c067312b8..b2554cd884ae060d9ad806ee0412d233e73a8b57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.6.0", + "version": "2.6.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ff98cdb21e037689121ec043556cb380faa6c6d5..70b5d8a08c41ad69cf3fbfd2c8d95a4523064619 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.6.1", + "version": "2.6.2", "description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "build-aot": "ng build && node ./third_party/matomo/processMatomo.js", diff --git a/src/res/favicons/favicon-128-dark.svg b/src/assets/favicons/favicon-128-dark.svg similarity index 100% rename from src/res/favicons/favicon-128-dark.svg rename to src/assets/favicons/favicon-128-dark.svg diff --git a/src/res/favicons/favicon-128-light.png b/src/assets/favicons/favicon-128-light.png similarity index 100% rename from src/res/favicons/favicon-128-light.png rename to src/assets/favicons/favicon-128-light.png diff --git a/src/res/favicons/favicon-128-light.svg b/src/assets/favicons/favicon-128-light.svg similarity index 100% rename from src/res/favicons/favicon-128-light.svg rename to src/assets/favicons/favicon-128-light.svg diff --git a/src/atlasComponents/userAnnotations/tools/service.ts b/src/atlasComponents/userAnnotations/tools/service.ts index dccdc60427a025b8c0e9fc974e03bc6e23f959ee..26fc809549b7f7fd59740539aaaec0e09ae66a4a 100644 --- a/src/atlasComponents/userAnnotations/tools/service.ts +++ b/src/atlasComponents/userAnnotations/tools/service.ts @@ -172,7 +172,7 @@ export class ModularUserAnnotationToolService implements OnDestroy{ const d = (arg as TCallback['message']['callArg'] & { type: any }) const { message, actionCallback, action = null } = d this.snackbar.open(message, action, { - duration: 3000 + duration: 5000 }).afterDismissed().subscribe(({ dismissedByAction }) => { if (dismissedByAction && actionCallback) actionCallback() }) diff --git a/src/atlasComponents/userAnnotations/tools/type.ts b/src/atlasComponents/userAnnotations/tools/type.ts index 8e33221b9bdf575fd3e2a196711236dce78b6d3b..763a58fcb59efc5aeee758008f2d5a6c710ac7c7 100644 --- a/src/atlasComponents/userAnnotations/tools/type.ts +++ b/src/atlasComponents/userAnnotations/tools/type.ts @@ -156,7 +156,23 @@ export abstract class AbsToolClass<T extends IAnnotationGeometry> { public addAnnotation(geom: T) { const found = this.managedAnnotations.find(ann => ann.id === geom.id) - if (found) found.remove() + if (found) { + this.callback({ + type: "message", + message: `Annotation with id ${found.id} already exist under the name ${found.name}. Replaced with ${geom.name}`, + action: "Learn more", + actionCallback: () => { + // see issue https://github.com/FZJ-INM1-BDA/siibra-explorer/issues/1128 + const a = document.createElement("a") + a.href = "https://github.com/FZJ-INM1-BDA/siibra-explorer/issues/1128" + a.target = "_blank" + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + } + }) + found.remove() + } const sub = geom.updateSignal$.subscribe(() => { this.managedAnnotations$.next(this.managedAnnotations) }) diff --git a/src/environments/parseEnv.js b/src/environments/parseEnv.js index 84c95658b5b7466938de4d8c8f675950662b1162..dbd985314dc0c472611870143293d584b95e1e11 100644 --- a/src/environments/parseEnv.js +++ b/src/environments/parseEnv.js @@ -16,6 +16,18 @@ const main = async () => { GIT_HASH = 'unknown hash', EXPERIMENTAL_FEATURE_FLAG } = process.env + + console.log(`[parseEnv.js] parse envvar:`, { + BACKEND_URL, + DATASET_PREVIEW_URL, + STRICT_LOCAL, + MATOMO_URL, + MATOMO_ID, + BS_REST_URL, + VERSION, + GIT_HASH, + EXPERIMENTAL_FEATURE_FLAG, + }) const version = JSON.stringify( VERSION || 'unknown version' ) diff --git a/src/index.html b/src/index.html index 8fd23a5d9027b1514df06dc820b766c9b0027af7..0928ef9d4a1e014365a41dedc3481534b08f68f5 100644 --- a/src/index.html +++ b/src/index.html @@ -10,15 +10,11 @@ <link rel="stylesheet" href="icons/iav-icons.css"> <link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="version.css"> - <link rel="icon" type="image/png" href="res/favicons/favicon-128-light.png"/> - <script> - // disable zone patching of raf. This hampers NG performance significantly - window['__Zone_disable_requestAnimationFrame'] = true - </script> - <script src="https://unpkg.com/kg-dataset-previewer@1.2.0/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer> - </script> + <link rel="icon" type="image/png" href="assets/favicons/favicon-128-light.png"/> + <script src="extra_js.js"></script> + <script src="https://unpkg.com/kg-dataset-previewer@1.2.0/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer></script> <script src="https://unpkg.com/three-surfer@0.0.10/dist/bundle.js" defer></script> - <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.4/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> + <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.5/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> <title>Interactive Atlas Viewer</title> </head> diff --git a/src/main-common.ts b/src/main-common.ts index c3f3f5ee2d1f07260b1932bbe9152d65c7e81dc7..3bfc08878e14626e0a9cc0c95d26806ed27a47e3 100644 --- a/src/main-common.ts +++ b/src/main-common.ts @@ -20,11 +20,6 @@ import '!!file-loader?context=src/res&name=icons/iav-icons.ttf!src/res/icons/iav import '!!file-loader?context=src/res&name=icons/iav-icons.woff!src/res/icons/iav-icons.woff' import '!!file-loader?context=src/res&name=icons/iav-icons.svg!src/res/icons/iav-icons.svg' -/** - * favicons - */ -import '!!file-loader?context=src/res/favicons&name=favicon-128-light.png!src/res/favicons/favicon-128-light.png' - /** * version css */ diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts index 5d69b140153b700a2d76e35070602b6fba98dc23..130ee0d1dbc0ba1b820dfe0e7c915e5e2e8b6138 100644 --- a/src/util/pureConstant.service.ts +++ b/src/util/pureConstant.service.ts @@ -17,7 +17,7 @@ import { MatSnackBar } from "@angular/material/snack-bar"; import { TTemplateImage } from "./interfaces"; export const SIIBRA_API_VERSION_HEADER_KEY='x-siibra-api-version' -export const SIIBRA_API_VERSION = '0.1.8' +export const SIIBRA_API_VERSION = '0.1.9' const validVolumeType = new Set([ 'neuroglancer/precomputed', diff --git a/src/viewerModule/nehuba/nehubaContainer.component.spec.ts b/src/viewerModule/nehuba/nehubaContainer.component.spec.ts deleted file mode 100644 index 24fc4230411831d5e2f4c71ed5b9afa575645aa5..0000000000000000000000000000000000000000 --- a/src/viewerModule/nehuba/nehubaContainer.component.spec.ts +++ /dev/null @@ -1,684 +0,0 @@ - -// const { -// TOGGLE_SIDE_PANEL, -// EXPAND, -// COLLAPSE, -// ZOOM_IN, -// ZOOM_OUT, -// TOGGLE_FRONTAL_OCTANT -// } = ARIA_LABELS - -// const bigbrainJson = { -// ..._bigbrainJson, -// nehubaConfig: _bigbrainNehubaConfigJson -// } -// const importNehubaSpy = jasmine.createSpy('importNehubaSpy').and.returnValue(Promise.reject()) - -describe('> nehubaContainer.component.ts', () => { - - describe('> NehubaContainer', () => { - - // beforeEach(async(() => { - - // TestBed.configureTestingModule({ - // imports: [ - // NoopAnimationsModule, - // WidgetModule, - // AngularMaterialModule, - // LayoutModule, - // UtilModule, - // NehubaModule, - // AuthModule, - // StateModule, - // FormsModule, - // ReactiveFormsModule, - // HttpClientModule, - // CommonModule, - // RegionalFeaturesModule, - // ParcellationRegionModule, - // AtlasCmpParcellationModule, - - // /** - // * because the change done to pureconstant service, need to intercept http call to avoid crypto error message - // * so and so components needs to be compiled first. make sure you call compileComponents - // */ - // HttpClientTestingModule, - // Landmark2DModule, - // ], - // declarations: [ - // NehubaContainer, - // TouchSideClass, - // MaximisePanelButton, - // AtlasLayerSelector, - // StatusCardComponent, - // NehubaViewerTouchDirective, - // MobileOverlay, - - // SplashScreen, - // CurrentLayout, - - // // pipes - // MobileControlNubStylePipe, - // ReorderPanelIndexPipe, - - // RegionAccordionTooltipTextPipe, - // ], - // providers: [ - // provideMockStore({ initialState: defaultRootState }), - // { - // provide: IMPORT_NEHUBA_INJECT_TOKEN, - // useValue: importNehubaSpy - // }, - // PureContantService, - // ], - // schemas: [ - // CUSTOM_ELEMENTS_SCHEMA - // ], - // }).compileComponents() - - // })) - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // const el = fixture.debugElement.componentInstance - // expect(el).toBeTruthy() - it('> component can be created') - - describe('> on selectedTemplatechange', () => { - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - - // const mockStore = TestBed.inject(MockStore) - // const newState = { - // ...defaultRootState, - // viewerState: { - // ...defaultRootState.viewerState, - // fetchedTemplates: [ bigbrainJson ], - // templateSelected: bigbrainJson, - // parcellationSelected: bigbrainJson.parcellations[0] - // }, - // [viewerStateHelperStoreName]: { - // fetchedAtlases: [ humanAtlas ], - // selectedAtlasId: humanAtlas['@id'] - // } - // } - - // mockStore.setState(newState) - // fixture.detectChanges() - // expect(importNehubaSpy).toHaveBeenCalled() - it('> calls importNehubaPr') - - /** - * TODO perhaps move this to e2e? - */ - it('> drag handle reattaches properly') - }) - - describe('> on selectedparcellation change', () => { - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // const el = fixture.debugElement.componentInstance as NehubaContainer - // const mockStore = TestBed.inject(MockStore) - // const newState = { - // ...defaultRootState, - // viewerState: { - // ...defaultRootState.viewerState, - // fetchedTemplates: [ bigbrainJson ], - // templateSelected: bigbrainJson, - // parcellationSelected: bigbrainJson.parcellations[0] - // }, - // [viewerStateHelperStoreName]: { - // fetchedAtlases: [ humanAtlas ], - // selectedAtlasId: humanAtlas['@id'] - // } - // } - - // mockStore.setState(newState) - // fixture.detectChanges() - - // const setSpy = spyOnProperty(el.nehubaViewer, 'ngIds', 'set') - - // const newState2 = { - // ...defaultRootState, - // viewerState: { - // ...defaultRootState.viewerState, - // fetchedTemplates: [ bigbrainJson ], - // templateSelected: bigbrainJson, - // parcellationSelected: bigbrainJson.parcellations[1] - // }, - // [viewerStateHelperStoreName]: { - // fetchedAtlases: [ humanAtlas ], - // selectedAtlasId: humanAtlas['@id'] - // } - // } - - // mockStore.setState(newState2) - // fixture.detectChanges() - - // expect(setSpy).toHaveBeenCalled() - it('> should set ngId of nehubaViewer') - }) - - describe('> extended sidepanel hides and shows as expected', () => { - describe('> on start, if nothing is selected', () => { - // beforeEach(() => { - // const mockStore = TestBed.inject(MockStore) - // const newState = { - // ...defaultRootState, - // viewerState: { - // ...defaultRootState.viewerState, - // fetchedTemplates: [ bigbrainJson ], - // templateSelected: bigbrainJson, - // parcellationSelected: bigbrainJson.parcellations[0] - // }, - // [viewerStateHelperStoreName]: { - // fetchedAtlases: [ humanAtlas ], - // selectedAtlasId: humanAtlas['@id'] - // } - // } - - // mockStore.setState(newState) - // }) - - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(false) - // expect( - // fixture.componentInstance.matDrawerMinor.opened - // ).toEqual(false) - it('> both should be shut') - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const toggleBtn = fixture.debugElement.query( By.css(`[aria-label="${TOGGLE_SIDE_PANEL}"]`) ) - // toggleBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(true) - // expect( - // fixture.componentInstance.matDrawerMinor.opened - // ).toEqual(false) - it('> opening via tab should result in only top drawer open') - - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const toggleBtn = fixture.debugElement.query( By.css(`[aria-label="${TOGGLE_SIDE_PANEL}"]`) ) - // toggleBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - // const expandRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-secondary-open="true"] [aria-label="${EXPAND}"]`) ) - // expect(expandRegionFeatureBtn).toBeNull() - it('> on opening top drawer, explore features should not be present') - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const toggleBtn = fixture.debugElement.query( By.css(`[aria-label="${TOGGLE_SIDE_PANEL}"]`) ) - // toggleBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - // const expandRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-secondary-open="true"] [aria-label="${COLLAPSE}"]`) ) - // expect(expandRegionFeatureBtn).toBeNull() - it('> collapse btn should not be visible') - }) - - describe('> on start, if something is selected', () => { - // beforeEach(() => { - // const mockStore = TestBed.inject(MockStore) - // const newState = { - // ...defaultRootState, - // viewerState: { - // ...defaultRootState.viewerState, - // fetchedTemplates: [ bigbrainJson ], - // templateSelected: bigbrainJson, - // parcellationSelected: bigbrainJson.parcellations[0], - // regionsSelected: [{ - // name: "foobar", - // ngId: 'untitled', - // labelIndex: 15 - // }] - // }, - // [viewerStateHelperStoreName]: { - // fetchedAtlases: [ humanAtlas ], - // selectedAtlasId: humanAtlas['@id'] - // } - // } - - // mockStore.setState(newState) - // }) - - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(true) - // expect( - // fixture.componentInstance.matDrawerMinor.opened - // ).toEqual(true) - - // expect( - // fixture.componentInstance.navSideDrawerMainSwitch.switchState - // ).toEqual(true) - // expect( - // fixture.componentInstance.navSideDrawerMinorSwitch.switchState - // ).toEqual(true) - it('> both should be open') - - - // () => { - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const toggleBtn = fixture.debugElement.query( By.css(`[aria-label="${TOGGLE_SIDE_PANEL}"]`) ) - // toggleBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(false) - - // /** - // * TODO investigate why openedStart/closedStart events fail to fire - // */ - // // expect( - // // fixture.componentInstance.matDrawerMinor.opened - // // ).toEqual(false) - - // // expect( - // // fixture.componentInstance.navSideDrawerMainSwitch.switchState - // // ).toEqual(false) - // // expect( - // // fixture.componentInstance.navSideDrawerMinorSwitch.switchState - // // ).toEqual(false) - // } - it('> closing main drawer via tag should close both') - - - // () => { - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const collapseRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-secondary-open="true"] [aria-label="${COLLAPSE}"]`) ) - // expect(collapseRegionFeatureBtn).not.toBeNull() - // } - it('> collapse btn should be visible') - - // () => { - - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const collapseRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-secondary-open="true"] [aria-label="${COLLAPSE}"]`) ) - // collapseRegionFeatureBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(true) - - // /** - // * TODO investigate why property does not get updated - // */ - // // expect( - // // fixture.componentInstance.matDrawerMinor.opened - // // ).toEqual(false) - - // expect( - // fixture.componentInstance.navSideDrawerMainSwitch.switchState - // ).toEqual(true) - // expect( - // fixture.componentInstance.navSideDrawerMinorSwitch.switchState - // ).toEqual(false) - // } - it('> clicking on collapse btn should minimize 1 drawer') - - // () => { - // const fixture = TestBed.createComponent(NehubaContainer) - // fixture.componentInstance.currentOnHoverObs$ = hot('') - // fixture.detectChanges() - // const collapseRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-secondary-open="true"] [aria-label="${COLLAPSE}"]`) ) - // collapseRegionFeatureBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - // const expandRegionFeatureBtn = fixture.debugElement.query( By.css(`mat-drawer[data-mat-drawer-primary-open="true"] [aria-label="${EXPAND}"]`) ) - // expandRegionFeatureBtn.triggerEventHandler('click', null) - // fixture.detectChanges() - - // expect( - // fixture.componentInstance.matDrawerMain.opened - // ).toEqual(true) - // expect( - // fixture.componentInstance.matDrawerMinor.opened - // ).toEqual(true) - - // expect( - // fixture.componentInstance.navSideDrawerMainSwitch.switchState - // ).toEqual(true) - // /** - // * TODO figoure out why switch state is updated async, and karma can't force update state - // */ - // // expect( - // // fixture.componentInstance.navSideDrawerMinorSwitch.switchState - // // ).toEqual(true) - // } - it('> on minimize drawer, clicking expand btn should expand everything') - }) - - describe('> side bar content', () => { - - /** - * TODO - */ - it('> if nothing is shown, it should show place holder text') - - /** - * TODO - */ - it('> if something (region features/connectivity) exists, placeh holder text should be hdiden') - }) - }) - - describe('> panelCtrl', () => { - // let fixture: ComponentFixture<NehubaContainer> - // const setViewerLoaded = () => { - // fixture.componentInstance.viewerLoaded = true - // } - // const ctrlElementIsVisible = (el: DebugElement) => { - // const visible = (el.nativeElement as HTMLElement).getAttribute('data-viewer-controller-visible') - // return visible === 'true' - // } - // beforeEach(() => { - // fixture = TestBed.createComponent(NehubaContainer) - // }) - - // () => { - // fixture.detectChanges() - // setViewerLoaded() - // fixture.detectChanges() - // for (const idx of [0, 1, 2, 3]) { - // const el = fixture.debugElement.query( - // By.css(`[data-viewer-controller-index="${idx}"]`) - // ) - // expect(el).toBeTruthy() - // } - // } - it('> on start, all four ctrl panels exists') - - // () => { - - // fixture.detectChanges() - // setViewerLoaded() - // fixture.detectChanges() - // for (const idx of [0, 1, 2, 3]) { - // const el = fixture.debugElement.query( - // By.css(`[data-viewer-controller-index="${idx}"]`) - // ) - // expect(ctrlElementIsVisible(el)).toBeFalsy() - // } - // } - it('> on start all four ctrl panels are invisible') - - describe('> on hover, only the hovered panel have ctrl shown', () => { - - for (const idx of [0, 1, 2, 3]) { - - // fakeAsync(() => { - // fixture.detectChanges() - // const findPanelIndexSpy = spyOn<any>(fixture.componentInstance, 'findPanelIndex').and.callFake(() => { - // return idx - // }) - // setViewerLoaded() - // fixture.detectChanges() - // const nativeElement = fixture.componentInstance['elementRef'].nativeElement - // nativeElement.dispatchEvent(new MouseEvent('mouseover', { bubbles: true })) - - // /** - // * assert findPanelIndex called with event.target, i.e. native element in thsi case - // */ - // expect(findPanelIndexSpy).toHaveBeenCalledWith(nativeElement) - // tick(200) - // fixture.detectChanges() - - // /** - // * every panel index should be non visible - // * only when idx matches, it can be visible - // * n.b. this does not test visual visibility (which is controlled by extra-style.css) - // * (which is also affected by global [ismobile] configuration) - // * - // * this merely test the unit logic, and sets the flag appropriately - // */ - // for (const iterativeIdx of [0, 1, 2, 3]) { - // const el = fixture.debugElement.query( - // By.css(`[data-viewer-controller-index="${iterativeIdx}"]`) - // ) - // if (iterativeIdx === idx) { - // expect(ctrlElementIsVisible(el)).toBeTruthy() - // } else { - // expect(ctrlElementIsVisible(el)).toBeFalsy() - // } - // } - // discardPeriodicTasks() - // }) - it(`> on hoveredPanelIndices$ emit ${idx}, the panel index ${idx} ctrl becomes visible`) - } - - }) - - describe('> on maximise top right slice panel (idx 1)', () => { - // beforeEach(() => { - // const mockStore = TestBed.inject(MockStore) - // mockStore.overrideSelector(ngViewerSelectorPanelMode, PANELS.SINGLE_PANEL) - // mockStore.overrideSelector(ngViewerSelectorPanelOrder, '1230') - - // fixture.detectChanges() - // setViewerLoaded() - // fixture.detectChanges() - // }) - - - // () => { - - // const toggleBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${TOGGLE_FRONTAL_OCTANT}"]`) - // ) - // expect(toggleBtn).toBeFalsy() - // } - it('> toggle front octant btn not visible') - - // () => { - - // const zoomInBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_IN}"]`) - // ) - - // const zoomOutBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_OUT}"]`) - // ) - - // expect(zoomInBtn).toBeTruthy() - // expect(zoomOutBtn).toBeTruthy() - // } - it('> zoom in and out btns are visible') - - // () => { - // const zoomViewSpy = spyOn(fixture.componentInstance, 'zoomNgView') - - // const zoomInBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_IN}"]`) - // ) - // zoomInBtn.triggerEventHandler('click', null) - // expect(zoomViewSpy).toHaveBeenCalled() - // const { args } = zoomViewSpy.calls.first() - // expect(args[0]).toEqual(1) - // /** - // * zoom in < 1 - // */ - // expect(args[1]).toBeLessThan(1) - // } - it('> zoom in btn calls fn with right param') - - // () => { - // const zoomViewSpy = spyOn(fixture.componentInstance, 'zoomNgView') - - // const zoomOutBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_OUT}"]`) - // ) - // zoomOutBtn.triggerEventHandler('click', null) - // expect(zoomViewSpy).toHaveBeenCalled() - // const { args } = zoomViewSpy.calls.first() - // expect(args[0]).toEqual(1) - // /** - // * zoom out > 1 - // */ - // expect(args[1]).toBeGreaterThan(1) - // } - it('> zoom out btn calls fn with right param') - }) - - describe('> on maximise perspective panel', () => { - // beforeEach(() => { - // const mockStore = TestBed.inject(MockStore) - // mockStore.overrideSelector(ngViewerSelectorPanelMode, PANELS.SINGLE_PANEL) - // mockStore.overrideSelector(ngViewerSelectorPanelOrder, '3012') - - // fixture.detectChanges() - // setViewerLoaded() - // fixture.detectChanges() - // }) - - - // () => { - // const setOctantRemovalSpy = spyOn(fixture.componentInstance, 'setOctantRemoval') - - // const toggleBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${TOGGLE_FRONTAL_OCTANT}"]`) - // ) - // expect(toggleBtn).toBeTruthy() - // toggleBtn.nativeElement.dispatchEvent( - // new MouseEvent('click', { bubbles: true }) - // ) - // expect(setOctantRemovalSpy).toHaveBeenCalled() - // } - it('> toggle octant btn visible and functional') - - // () => { - // const zoomViewSpy = spyOn(fixture.componentInstance, 'zoomNgView') - - // const zoomInBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_IN}"]`) - // ) - // expect(zoomInBtn).toBeTruthy() - - // zoomInBtn.triggerEventHandler('click', null) - // expect(zoomViewSpy).toHaveBeenCalled() - // const { args } = zoomViewSpy.calls.first() - // expect(args[0]).toEqual(3) - // /** - // * zoom in < 1 - // */ - // expect(args[1]).toBeLessThan(1) - // } - it('> zoom in btn visible and functional') - - // () => { - // const zoomViewSpy = spyOn(fixture.componentInstance, 'zoomNgView') - - // const zoomOutBtn = fixture.debugElement.query( - // By.css(`[cell-i] [aria-label="${ZOOM_OUT}"]`) - // ) - // expect(zoomOutBtn).toBeTruthy() - - // zoomOutBtn.triggerEventHandler('click', null) - // expect(zoomViewSpy).toHaveBeenCalled() - // const { args } = zoomViewSpy.calls.first() - // expect(args[0]).toEqual(3) - // /** - // * zoom in < 1 - // */ - // expect(args[1]).toBeGreaterThan(1) - // } - it('> zoom out btn visible and functional') - - }) - }) - - describe('> on userLandmarks change', () => { - const lm1 = { - id: 'test-1', - position: [0, 0, 0] - } - const lm2 = { - id: 'test-2', - position: [1, 1,1 ] - } - - // () => { - // const fixture = TestBed.createComponent(NehubaContainer) - - // fixture.componentInstance.nehubaViewer = { - // updateUserLandmarks: () => {} - // } as any - - // const updateUserLandmarksSpy = spyOn( - // fixture.componentInstance.nehubaViewer, - // 'updateUserLandmarks' - // ) - - // const mockStore = TestBed.inject(MockStore) - // mockStore.overrideSelector(viewerStateCustomLandmarkSelector, [ - // lm1, - // lm2 - // ]) - // fixture.detectChanges() - // expect( - // updateUserLandmarksSpy - // ).toHaveBeenCalledWith([ - // lm1, lm2 - // ]) - // } - it('> calls nehubaViewer.updateUserLandmarks') - - // () => { - - // const fixture = TestBed.createComponent(NehubaContainer) - - // fixture.componentInstance.nehubaContainerDirective = { - // toggleOctantRemoval: () => {}, - // clear: () => {} - // } as any - - // const toggleOctantRemovalSpy = spyOn( - // fixture.componentInstance.nehubaContainerDirective, - // 'toggleOctantRemoval' - // ) - - // const mockStore = TestBed.inject(MockStore) - // mockStore.overrideSelector(viewerStateCustomLandmarkSelector, [ - // lm1, - // lm2 - // ]) - // mockStore.overrideSelector(ngViewerSelectorOctantRemoval, true) - // fixture.detectChanges() - // expect( - // toggleOctantRemovalSpy - // ).toHaveBeenCalledWith(false) - // } - it('> calls togglecotantREmoval') - }) - }) -}) diff --git a/third_party/extra_js.js b/third_party/extra_js.js new file mode 100644 index 0000000000000000000000000000000000000000..82febd16a73314d0b797ae6ced9957d4849af412 --- /dev/null +++ b/third_party/extra_js.js @@ -0,0 +1,2 @@ +// disable zone patching of raf. This hampers NG performance significantly +window['__Zone_disable_requestAnimationFrame'] = true \ No newline at end of file