mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-8081] People facet - update the query on apply hit (#9904)
* [ACS-8081] People facet - update the query on apply hit * [ACS-8081] cr fix
This commit is contained in:
committed by
GitHub
parent
02257fb552
commit
48d96760eb
@@ -87,7 +87,8 @@ export class SearchFacetChipTabbedComponent {
|
||||
this.menuTrigger.closeMenu();
|
||||
}
|
||||
}
|
||||
onIsPopulatedEventChange(isPopulated: boolean): void {
|
||||
|
||||
onIsPopulatedEventChange(isPopulated: boolean) {
|
||||
this.isPopulated = isPopulated;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ import { FacetField } from '../../../models/facet-field.interface';
|
||||
import { SearchFacetFiltersService } from '../../../services/search-facet-filters.service';
|
||||
import { NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
|
||||
import { SearchFacetTabbedContentComponent } from './search-facet-tabbed-content.component';
|
||||
import { of } from 'rxjs';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatTabGroupHarness, MatTabHarness } from '@angular/material/tabs/testing';
|
||||
@@ -34,6 +33,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
||||
let queryBuilder: SearchQueryBuilderService;
|
||||
let searchFacetService: SearchFacetFiltersService;
|
||||
let loader: HarnessLoader;
|
||||
let queryBuilderUpdateSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -45,7 +45,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
queryBuilder = TestBed.inject(SearchQueryBuilderService);
|
||||
searchFacetService = TestBed.inject(SearchFacetFiltersService);
|
||||
spyOn(queryBuilder, 'update').and.stub();
|
||||
queryBuilderUpdateSpy = spyOn(queryBuilder, 'update').and.stub();
|
||||
|
||||
const facet1: FacetField = { type: 'field', label: 'field', field: 'field', buckets: new SearchFilterList() };
|
||||
const facet2: FacetField = { type: 'field', label: 'field2', field: 'field2', buckets: new SearchFilterList() };
|
||||
@@ -59,9 +59,6 @@ describe('SearchFacetTabbedContentComponent', () => {
|
||||
}
|
||||
};
|
||||
|
||||
component.onReset$ = of(void 0);
|
||||
component.onApply$ = of(void 0);
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -189,7 +186,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
||||
spyOn(searchFacetService, 'updateSelectedBuckets').and.callThrough();
|
||||
component.submitValues();
|
||||
expect(component.submitValues).toHaveBeenCalled();
|
||||
expect(queryBuilder.update).toHaveBeenCalled();
|
||||
expect(queryBuilderUpdateSpy).toHaveBeenCalled();
|
||||
expect(component.updateDisplayValue).toHaveBeenCalled();
|
||||
expect(searchFacetService.updateSelectedBuckets).toHaveBeenCalled();
|
||||
});
|
||||
@@ -197,7 +194,12 @@ describe('SearchFacetTabbedContentComponent', () => {
|
||||
it('should update search query and display value on reset', () => {
|
||||
spyOn(component, 'updateDisplayValue').and.callThrough();
|
||||
component.reset();
|
||||
expect(queryBuilder.update).toHaveBeenCalled();
|
||||
expect(queryBuilderUpdateSpy).toHaveBeenCalled();
|
||||
expect(component.updateDisplayValue).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call queryBuilder.update on options change', () => {
|
||||
component.onOptionsChange([{ value: 'test' }], 'field');
|
||||
expect(queryBuilderUpdateSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -93,7 +93,6 @@ export class SearchFacetTabbedContentComponent implements OnInit, OnDestroy, OnC
|
||||
this.isPopulated.emit(this.tabbedFacet.fields.some((facetField) => this.selectedOptions[facetField].length > 0));
|
||||
this.updateDisplayValue();
|
||||
this.updateUserFacetBuckets();
|
||||
this.queryBuilder.update();
|
||||
}
|
||||
|
||||
updateDisplayValue() {
|
||||
|
Reference in New Issue
Block a user