diff --git a/e2e/src/selecting/template.e2e-spec.js b/e2e/src/selecting/template.e2e-spec.js index 433571e3f2b1417f260ba25af65616c1d44ebd1f..5e73bc195bde80e24aa3d23eb6018082c2eba6b3 100644 --- a/e2e/src/selecting/template.e2e-spec.js +++ b/e2e/src/selecting/template.e2e-spec.js @@ -31,4 +31,20 @@ describe('selecting template', () => { const viewerIsPopulated = await iavPage.viewerIsPopulated() expect(viewerIsPopulated).toBe(true) }) + + it('MNI152 should return desc', async () => { + + const expectedDesc = `An unbiased non-linear average of multiple subjects from the MNI152 database, which provides high-spatial resolution and signal-to-noise while not being biased towards a single brain (Fonov et al., 2011). This template space is widely used as a reference space in neuroimaging. HBP provides the JuBrain probabilistic cytoarchitectonic atlas (Amunts/Zilles, 2015) as well as a probabilistic atlas of large fibre bundles (Guevara, Mangin et al., 2017) in this space.` + + await iavPage.goto() + + await iavPage.selectTitleCard('ICBM 2009c Nonlinear Asymmetric') + await iavPage.wait(1000) + + const info = await iavPage.getTemplateInfo() + + expect( + info.indexOf(expectedDesc) + ).toBeGreaterThanOrEqual(0) + }) }) diff --git a/e2e/src/util.js b/e2e/src/util.js index 454b8c706917d6a7c683ff5e6a631e6ea83643b6..5aad51bf46cfdaf97fbd44f3bcd2cd9f711a7b1d 100644 --- a/e2e/src/util.js +++ b/e2e/src/util.js @@ -210,6 +210,28 @@ class WdLayoutPage extends WdBase{ // Will throw if status panel is not visible return this._getStatusPanel().click() } + + // will throw if sidenav is not visible + async getTemplateInfo(){ + const ariaText = `Hover to find out more info on the selected template` + const infoBtn = await this._getSideNav() + .findElement( By.css(`[aria-label="${ariaText}"]`) ) + + await this._driver.actions() + .move() + .move({ + origin: infoBtn, + duration: 1000 + }) + .perform() + + await this.wait(500) + const text = await this._getSideNav() + .findElement( By.id('selected-template-detailed-info') ) + .getText() + + return text + } } class WdIavPage extends WdLayoutPage{ diff --git a/src/components/markdown/markdown.component.ts b/src/components/markdown/markdown.component.ts index 35f53517540acced1613864dc71be4faa2570744..231875a485f499f02b0c2d64ce465b2e0585aa38 100644 --- a/src/components/markdown/markdown.component.ts +++ b/src/components/markdown/markdown.component.ts @@ -32,7 +32,7 @@ export class MarkdownDom implements AfterViewChecked { this.innerHtml = this.converter.makeHtml( this.getMarkdown() ) - this.cdr.markForCheck() + this.cdr.detectChanges() } @ViewChild('ngContentWrapper', {read : ElementRef, static: true}) diff --git a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.spec.ts b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7cf7c9f2f7d0a11f35d7551131079eefaf7b299f --- /dev/null +++ b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.spec.ts @@ -0,0 +1,5 @@ +describe('singleDataset.component.ts', () => { + describe('', () => { + + }) +}) \ No newline at end of file diff --git a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.ts b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.ts index 15a950c512ce27168d3e08b7412107ecea9f4f21..6659e3791e4fed9af7cddfc986efb86b75e239db 100644 --- a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.ts +++ b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Optional} from "@angular/core"; import { - AtlasViewerConstantsServices, DatabrowserService, KgSingleDatasetService, SingleDatasetBase, @@ -22,11 +21,10 @@ export class SingleDatasetView extends SingleDatasetBase { dbService: DatabrowserService, singleDatasetService: KgSingleDatasetService, cdr: ChangeDetectorRef, - constantService: AtlasViewerConstantsServices, @Optional() @Inject(MAT_DIALOG_DATA) data: any, ) { - super(dbService, singleDatasetService, cdr, constantService, data) + super(dbService, singleDatasetService, cdr, data) } } diff --git a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts index 08dcdc171aeae8d7ff935fe2a2662a2178b3f119..e30630467500748ffd1075ee20066794eeb28542 100644 --- a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts +++ b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts @@ -2,7 +2,6 @@ import { Component, ChangeDetectionStrategy, ChangeDetectorRef } from "@angular/ SingleDatasetBase, DatabrowserService, KgSingleDatasetService, - AtlasViewerConstantsServices, } from "../singleDataset.base"; import { SingleDatasetView } from "../detailedView/singleDataset.component"; import {MatDialog} from "@angular/material/dialog"; @@ -23,11 +22,10 @@ export class SingleDatasetListView extends SingleDatasetBase { private _dbService: DatabrowserService, singleDatasetService: KgSingleDatasetService, cdr: ChangeDetectorRef, - constantService: AtlasViewerConstantsServices, private dialog: MatDialog, private snackBar: MatSnackBar, ) { - super(_dbService, singleDatasetService, cdr, constantService) + super(_dbService, singleDatasetService, cdr) } public showDetailInfo() { diff --git a/src/ui/databrowserModule/singleDataset/singleDataset.base.spec.ts b/src/ui/databrowserModule/singleDataset/singleDataset.base.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d7a31e71d193aa819432b42830fbbbca2865242 --- /dev/null +++ b/src/ui/databrowserModule/singleDataset/singleDataset.base.spec.ts @@ -0,0 +1,39 @@ +import { SingleDatasetView } from './detailedView/singleDataset.component' +import { TestBed, async } from '@angular/core/testing'; +import { AngularMaterialModule } from 'src/ui/sharedModules/angularMaterial.module'; +import { DatabrowserModule } from '../databrowser.module'; +import { ComponentsModule } from 'src/components/components.module'; +import { DatabrowserService, KgSingleDatasetService } from './singleDataset.base'; +import { provideMockStore } from '@ngrx/store/testing'; +import { defaultRootState } from 'src/services/stateStore.service'; +import { HttpClientModule } from '@angular/common/http'; + +describe('singleDataset.base.ts', () => { + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + AngularMaterialModule, + DatabrowserModule, + ComponentsModule, + HttpClientModule + ], + providers: [ + DatabrowserService, + KgSingleDatasetService, + provideMockStore({ + initialState: defaultRootState + }) + ] + }).compileComponents() + })) + describe('SingleDatasetBase', () => { + it('on init, component is truthy', () => { + + const fixture = TestBed.createComponent(SingleDatasetView) + const app = fixture.debugElement.componentInstance; + + expect(app).toBeTruthy(); + }) + }) +}) diff --git a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts index f8063d8c7e3bec0ce12cf3919279f92661200dfa..039a834d70ae4ae0fd78dcee07da90d45c750a71 100644 --- a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts +++ b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from "@angular/core"; +import { ChangeDetectorRef, Input, OnInit, TemplateRef } from "@angular/core"; import { Observable } from "rxjs"; import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service"; import { IDataEntry, IFile, IPublication, ViewerPreviewFile } from 'src/services/state/dataStore.store' @@ -12,7 +12,7 @@ export { DatabrowserService, KgSingleDatasetService, ChangeDetectorRef, - AtlasViewerConstantsServices, + AtlasViewerConstantsServices } export class SingleDatasetBase implements OnInit { @@ -59,8 +59,6 @@ export class SingleDatasetBase implements OnInit { private dbService: DatabrowserService, private singleDatasetService: KgSingleDatasetService, private cdr: ChangeDetectorRef, - private constantService: AtlasViewerConstantsServices, - dataset?: any, ) { diff --git a/src/ui/viewerStateController/viewerStateCFull/viewerState.template.html b/src/ui/viewerStateController/viewerStateCFull/viewerState.template.html index 2e11b8d7db09d47acfcf857f90fd244e44e59483..3ddd84ecbbf6f79bbd69ca4c6f359a782c2b1ae2 100644 --- a/src/ui/viewerStateController/viewerStateCFull/viewerState.template.html +++ b/src/ui/viewerStateController/viewerStateCFull/viewerState.template.html @@ -54,6 +54,7 @@ <mat-card *ngFor="let originDataset of moreInfo.originDatasets" class="position-absolute left-0 top-0 w-40em"> <single-dataset-view + id="selected-template-detailed-info" [name]="moreInfo.name" [description]="moreInfo.description" [publications]="moreInfo.publications"