Skip to content

Commit e251c2c

Browse files
Merge branch 'advanced-search_contribute-7.6' into advanced-search_contribute-main
# Conflicts: # src/app/shared/search-form/search-form.component.spec.ts # src/app/shared/search-form/search-form.component.ts
2 parents bc35bfb + 92cc112 commit e251c2c

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/app/shared/search-form/search-form.component.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@ import { Community } from '../../core/shared/community.model';
1818
import { DSpaceObject } from '../../core/shared/dspace-object.model';
1919
import { SearchService } from '../../core/shared/search/search.service';
2020
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
21+
import { SearchFilterService } from '../../core/shared/search/search-filter.service';
2122
import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils';
2223
import { PaginationServiceStub } from '../testing/pagination-service.stub';
2324
import { RouterStub } from '../testing/router.stub';
25+
import { SearchFilterServiceStub } from '../testing/search-filter-service.stub';
2426
import { SearchServiceStub } from '../testing/search-service.stub';
2527
import { SearchFormComponent } from './search-form.component';
2628

2729
describe('SearchFormComponent', () => {
2830
let comp: SearchFormComponent;
2931
let fixture: ComponentFixture<SearchFormComponent>;
3032
let de: DebugElement;
31-
let el: HTMLElement;
3233

3334
const router = new RouterStub();
3435
const searchService = new SearchServiceStub();
36+
let searchFilterService: SearchFilterServiceStub;
3537
const paginationService = new PaginationServiceStub();
3638
const searchConfigService = { paginationID: 'test-id' };
3739
const firstPage = { 'spc.page': 1 };
@@ -40,11 +42,14 @@ describe('SearchFormComponent', () => {
4042
};
4143

4244
beforeEach(waitForAsync(() => {
45+
searchFilterService = new SearchFilterServiceStub();
46+
4347
return TestBed.configureTestingModule({
4448
imports: [FormsModule, RouterTestingModule, TranslateModule.forRoot(), SearchFormComponent],
4549
providers: [
4650
{ provide: Router, useValue: router },
4751
{ provide: SearchService, useValue: searchService },
52+
{ provide: SearchFilterService, useValue: searchFilterService },
4853
{ provide: PaginationService, useValue: paginationService },
4954
{ provide: SearchConfigurationService, useValue: searchConfigService },
5055
{ provide: DSpaceObjectDataService, useValue: dspaceObjectService },
@@ -56,7 +61,6 @@ describe('SearchFormComponent', () => {
5661
fixture = TestBed.createComponent(SearchFormComponent);
5762
comp = fixture.componentInstance; // SearchFormComponent test instance
5863
de = fixture.debugElement.query(By.css('form'));
59-
el = de.nativeElement;
6064
});
6165

6266
it('should not display scopes when showScopeSelector is false', fakeAsync(() => {

src/app/shared/search-form/search-form.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { DSpaceObject } from '../../core/shared/dspace-object.model';
2626
import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators';
2727
import { SearchService } from '../../core/shared/search/search.service';
2828
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
29+
import { SearchFilterService } from '../../core/shared/search/search-filter.service';
2930
import {
3031
hasValue,
3132
isNotEmpty,
@@ -98,6 +99,7 @@ export class SearchFormComponent implements OnChanges {
9899
constructor(
99100
protected router: Router,
100101
protected searchService: SearchService,
102+
protected searchFilterService: SearchFilterService,
101103
protected paginationService: PaginationService,
102104
protected searchConfig: SearchConfigurationService,
103105
protected modalService: NgbModal,
@@ -134,6 +136,7 @@ export class SearchFormComponent implements OnChanges {
134136
*/
135137
onScopeChange(scope: DSpaceObject) {
136138
this.updateSearch({ scope: scope ? scope.uuid : undefined });
139+
this.searchFilterService.minimizeAll();
137140
}
138141

139142
/**

src/app/shared/search/search.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ export class SearchComponent implements OnDestroy, OnInit {
477477
* @private
478478
*/
479479
private retrieveFilters(searchOptions: PaginatedSearchOptions) {
480-
this.filtersRD$.next(null);
481480
this.searchConfigService.getConfig(searchOptions.scope, searchOptions.configuration).pipe(
482481
getFirstCompletedRemoteData(),
483482
).subscribe((filtersRD: RemoteData<SearchFilterConfig[]>) => {

0 commit comments

Comments
 (0)