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(''); }