Skip to content

Commit

Permalink
[ACS-6399] - ACA search properties facet clear button do not clear se…
Browse files Browse the repository at this point in the history
…arch filter (#9191)
  • Loading branch information
dominikiwanekhyland authored Dec 22, 2023
1 parent b9d3065 commit e9c769b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}
Expand Down

0 comments on commit e9c769b

Please sign in to comment.