mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
111731: Also minimize the search facets while switching scopes
This commit is contained in:
@@ -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<SearchFormComponent>;
|
||||
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(() => {
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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<SearchFilterConfig[]>) => {
|
||||
|
Reference in New Issue
Block a user