diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts index 584b7c5584..64bbbae154 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -17,15 +17,17 @@ import { BrowserOnlyMockPipe } from '../testing/browser-only-mock.pipe'; import { SearchServiceStub } from '../testing/search-service.stub'; import { Router } from '@angular/router'; import { RouterStub } from '../testing/router.stub'; +import { SearchFilterService } from '../../core/shared/search/search-filter.service'; +import { SearchFilterServiceStub } from '../testing/search-filter-service.stub'; describe('SearchFormComponent', () => { let comp: SearchFormComponent; let fixture: ComponentFixture; let de: DebugElement; - let el: HTMLElement; const router = new RouterStub(); const searchService = new SearchServiceStub(); + let searchFilterService: SearchFilterServiceStub; const paginationService = new PaginationServiceStub(); const searchConfigService = { paginationID: 'test-id' }; const dspaceObjectService = { @@ -33,11 +35,14 @@ describe('SearchFormComponent', () => { }; beforeEach(waitForAsync(() => { + searchFilterService = new SearchFilterServiceStub(); + return TestBed.configureTestingModule({ imports: [FormsModule, RouterTestingModule, TranslateModule.forRoot()], providers: [ { provide: Router, useValue: router }, { provide: SearchService, useValue: searchService }, + { provide: SearchFilterService, useValue: searchFilterService }, { provide: PaginationService, useValue: paginationService }, { provide: SearchConfigurationService, useValue: searchConfigService }, { provide: DSpaceObjectDataService, useValue: dspaceObjectService }, @@ -53,7 +58,6 @@ describe('SearchFormComponent', () => { fixture = TestBed.createComponent(SearchFormComponent); comp = fixture.componentInstance; // SearchFormComponent test instance de = fixture.debugElement.query(By.css('form')); - el = de.nativeElement; }); it('should not display scopes when showScopeSelector is false', fakeAsync(() => { diff --git a/src/app/shared/search-form/search-form.component.ts b/src/app/shared/search-form/search-form.component.ts index 151ded6f9e..7474c1cca8 100644 --- a/src/app/shared/search-form/search-form.component.ts +++ b/src/app/shared/search-form/search-form.component.ts @@ -13,6 +13,7 @@ import { BehaviorSubject } from 'rxjs'; import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { SearchFilterService } from '../../core/shared/search/search-filter.service'; @Component({ selector: 'ds-search-form', @@ -71,6 +72,7 @@ export class SearchFormComponent implements OnChanges { constructor( protected router: Router, protected searchService: SearchService, + protected searchFilterService: SearchFilterService, protected paginationService: PaginationService, protected searchConfig: SearchConfigurationService, protected modalService: NgbModal, @@ -107,6 +109,7 @@ export class SearchFormComponent implements OnChanges { */ onScopeChange(scope: DSpaceObject) { this.updateSearch({ scope: scope ? scope.uuid : undefined }); + this.searchFilterService.minimizeAll(); } /** diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index df8d1e4d64..60d3d8a4de 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -416,7 +416,6 @@ export class SearchComponent implements OnInit { * @private */ private retrieveFilters(searchOptions: PaginatedSearchOptions) { - this.filtersRD$.next(null); this.searchConfigService.getConfig(searchOptions.scope, searchOptions.configuration).pipe( getFirstCompletedRemoteData(), ).subscribe((filtersRD: RemoteData) => {