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();
|
this.menuTrigger.closeMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onIsPopulatedEventChange(isPopulated: boolean): void {
|
|
||||||
|
onIsPopulatedEventChange(isPopulated: boolean) {
|
||||||
this.isPopulated = isPopulated;
|
this.isPopulated = isPopulated;
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ import { FacetField } from '../../../models/facet-field.interface';
|
|||||||
import { SearchFacetFiltersService } from '../../../services/search-facet-filters.service';
|
import { SearchFacetFiltersService } from '../../../services/search-facet-filters.service';
|
||||||
import { NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
|
import { NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
|
||||||
import { SearchFacetTabbedContentComponent } from './search-facet-tabbed-content.component';
|
import { SearchFacetTabbedContentComponent } from './search-facet-tabbed-content.component';
|
||||||
import { of } from 'rxjs';
|
|
||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatTabGroupHarness, MatTabHarness } from '@angular/material/tabs/testing';
|
import { MatTabGroupHarness, MatTabHarness } from '@angular/material/tabs/testing';
|
||||||
@@ -34,6 +33,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
let queryBuilder: SearchQueryBuilderService;
|
let queryBuilder: SearchQueryBuilderService;
|
||||||
let searchFacetService: SearchFacetFiltersService;
|
let searchFacetService: SearchFacetFiltersService;
|
||||||
let loader: HarnessLoader;
|
let loader: HarnessLoader;
|
||||||
|
let queryBuilderUpdateSpy: jasmine.Spy;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -45,7 +45,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
queryBuilder = TestBed.inject(SearchQueryBuilderService);
|
queryBuilder = TestBed.inject(SearchQueryBuilderService);
|
||||||
searchFacetService = TestBed.inject(SearchFacetFiltersService);
|
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 facet1: FacetField = { type: 'field', label: 'field', field: 'field', buckets: new SearchFilterList() };
|
||||||
const facet2: FacetField = { type: 'field', label: 'field2', field: 'field2', 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();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -189,7 +186,7 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
spyOn(searchFacetService, 'updateSelectedBuckets').and.callThrough();
|
spyOn(searchFacetService, 'updateSelectedBuckets').and.callThrough();
|
||||||
component.submitValues();
|
component.submitValues();
|
||||||
expect(component.submitValues).toHaveBeenCalled();
|
expect(component.submitValues).toHaveBeenCalled();
|
||||||
expect(queryBuilder.update).toHaveBeenCalled();
|
expect(queryBuilderUpdateSpy).toHaveBeenCalled();
|
||||||
expect(component.updateDisplayValue).toHaveBeenCalled();
|
expect(component.updateDisplayValue).toHaveBeenCalled();
|
||||||
expect(searchFacetService.updateSelectedBuckets).toHaveBeenCalled();
|
expect(searchFacetService.updateSelectedBuckets).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -197,7 +194,12 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
it('should update search query and display value on reset', () => {
|
it('should update search query and display value on reset', () => {
|
||||||
spyOn(component, 'updateDisplayValue').and.callThrough();
|
spyOn(component, 'updateDisplayValue').and.callThrough();
|
||||||
component.reset();
|
component.reset();
|
||||||
expect(queryBuilder.update).toHaveBeenCalled();
|
expect(queryBuilderUpdateSpy).toHaveBeenCalled();
|
||||||
expect(component.updateDisplayValue).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.isPopulated.emit(this.tabbedFacet.fields.some((facetField) => this.selectedOptions[facetField].length > 0));
|
||||||
this.updateDisplayValue();
|
this.updateDisplayValue();
|
||||||
this.updateUserFacetBuckets();
|
this.updateUserFacetBuckets();
|
||||||
this.queryBuilder.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDisplayValue() {
|
updateDisplayValue() {
|
||||||
|
Reference in New Issue
Block a user