From e9c769bc309e433a0e3ac9c91134bb9ba41e6cf0 Mon Sep 17 00:00:00 2001 From: DominikIwanek <141320833+DominikIwanek@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:50:29 +0100 Subject: [PATCH] [ACS-6399] - ACA search properties facet clear button do not clear search filter (#9191) --- .../search-properties.component.spec.ts | 12 ++++++++++++ .../search-properties/search-properties.component.ts | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts index 2aaea1478ae..68d39e251ba 100644 --- a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts @@ -365,6 +365,18 @@ describe('SearchPropertiesComponent', () => { component.reset(); expect(component.displayValue$.next).toHaveBeenCalledWith(''); }); + + it('should clear the queryFragments for the component id and call update', () => { + component.context = TestBed.inject(SearchQueryBuilderService); + component.id = 'test-id'; + component.context.queryFragments[component.id] = 'test-query'; + fixture.detectChanges(); + spyOn(component.context, 'update'); + component.reset(); + + expect(component.context.queryFragments[component.id]).toBe(''); + expect(component.context.update).toHaveBeenCalled(); + }); }); describe('setValue', () => { diff --git a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.ts b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.ts index 34e44b3d58c..97c6632d3b4 100644 --- a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.ts +++ b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.ts @@ -150,6 +150,10 @@ export class SearchPropertiesComponent implements OnInit, AfterViewChecked, Sear reset() { this.form.reset(); + if (this.id && this.context) { + this.context.queryFragments[this.id] = ''; + this.context.update(); + } this.reset$.next(); this.displayValue$.next(''); }