mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fixed test and search facet issue for mydspace
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
id="search-sidebar"
|
id="search-sidebar"
|
||||||
[configurationList]="(configurationList$ | async)"
|
[configurationList]="(configurationList$ | async)"
|
||||||
[resultCount]="(resultsRD$ | async)?.payload.totalElements"
|
[resultCount]="(resultsRD$ | async)?.payload.totalElements"
|
||||||
[viewModeList]="viewModeList"></ds-search-sidebar>
|
[viewModeList]="viewModeList"
|
||||||
|
[inPlaceSearch]="inPlaceSearch"></ds-search-sidebar>
|
||||||
<div class="col-12 col-md-9">
|
<div class="col-12 col-md-9">
|
||||||
<ds-search-form id="search-form"
|
<ds-search-form id="search-form"
|
||||||
[query]="(searchOptions$ | async)?.query"
|
[query]="(searchOptions$ | async)?.query"
|
||||||
|
@@ -62,7 +62,6 @@ export class SearchFacetSelectedOptionComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.sub = observableCombineLatest(this.selectedValues$, this.searchConfigService.searchOptions)
|
this.sub = observableCombineLatest(this.selectedValues$, this.searchConfigService.searchOptions)
|
||||||
.subscribe(([selectedValues, searchOptions]) => {
|
.subscribe(([selectedValues, searchOptions]) => {
|
||||||
console.log(selectedValues);
|
|
||||||
this.updateRemoveParams(selectedValues)
|
this.updateRemoveParams(selectedValues)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ import { SearchFacetFilterComponent } from './search-facet-filter.component';
|
|||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { SearchConfigurationServiceStub } from '../../../../shared/testing/search-configuration-service-stub';
|
import { SearchConfigurationServiceStub } from '../../../../shared/testing/search-configuration-service-stub';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component';
|
||||||
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
describe('SearchFacetFilterComponent', () => {
|
describe('SearchFacetFilterComponent', () => {
|
||||||
let comp: SearchFacetFilterComponent;
|
let comp: SearchFacetFilterComponent;
|
||||||
@@ -173,7 +174,14 @@ describe('SearchFacetFilterComponent', () => {
|
|||||||
const searchUrl = '/search/path';
|
const searchUrl = '/search/path';
|
||||||
const testValue = 'test';
|
const testValue = 'test';
|
||||||
const data = testValue;
|
const data = testValue;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
comp.selectedValues$ = observableOf(selectedValues.map((value) =>
|
||||||
|
Object.assign(new FacetValue(), {
|
||||||
|
label: value,
|
||||||
|
value: value
|
||||||
|
})));
|
||||||
|
fixture.detectChanges();
|
||||||
spyOn(comp, 'getSearchLink').and.returnValue(searchUrl);
|
spyOn(comp, 'getSearchLink').and.returnValue(searchUrl);
|
||||||
comp.onSubmit(data);
|
comp.onSubmit(data);
|
||||||
});
|
});
|
||||||
|
@@ -137,7 +137,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
this.selectedValues$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe(
|
this.selectedValues$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe(
|
||||||
map((selectedValues) => {
|
map((selectedValues) => {
|
||||||
return selectedValues.map((value: string) => {
|
return selectedValues.map((value: string) => {
|
||||||
const fValue = [].concat(...rd.payload.map((page) => page.page)).find((facetValue: FacetValue) => facetValue.value === value)
|
const fValue = [].concat(...rd.payload.map((page) => page.page)).find((facetValue: FacetValue) => facetValue.value === value);
|
||||||
if (hasValue(fValue)) {
|
if (hasValue(fValue)) {
|
||||||
return fValue;
|
return fValue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user