Skip to content

Commit

Permalink
Merge pull request #1065 from geonetwork/me-search-filters-summary-ig…
Browse files Browse the repository at this point in the history
…nore-search

Editor: Ignore search value in filter reset button
  • Loading branch information
tkohr authored Dec 17, 2024
2 parents a6267b8 + dca5437 commit da5f436
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FieldFilters } from '@geonetwork-ui/common/domain/model/search'

class SearchFacadeMock {
searchFilters$ = new BehaviorSubject<FieldFilters>({
any: 'search should be ignored',
format: {},
isSpatial: {},
license: {},
Expand Down Expand Up @@ -94,7 +95,9 @@ describe('SearchFiltersSummaryComponent', () => {

it('should clear filters', () => {
component.clearFilters()
expect(searchService.setFilters).toHaveBeenCalledWith({})
expect(searchService.setFilters).toHaveBeenCalledWith({
any: 'search should be ignored',
})
})
})

Expand Down Expand Up @@ -139,6 +142,7 @@ describe('SearchFiltersSummaryComponent', () => {
it('should clear filters except with keys from FILTER_SUMMARY_IGNORE_LIST', () => {
const filters = {
owner: { 1: true },
any: 'search should be ignored',
format: {},
isSpatial: {},
license: {},
Expand All @@ -150,6 +154,7 @@ describe('SearchFiltersSummaryComponent', () => {
component.clearFilters()
expect(searchService.setFilters).toHaveBeenCalledWith({
owner: { 1: true },
any: 'search should be ignored',
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export class SearchFiltersSummaryComponent implements OnInit {
@Inject(FILTER_SUMMARY_IGNORE_LIST)
filterSummaryIgnoreList: string[]
) {
this.filterSummaryIgnoreList = filterSummaryIgnoreList || []
const defaultIgnoreList = ['any']
this.filterSummaryIgnoreList = [
...defaultIgnoreList,
...(filterSummaryIgnoreList ?? []),
]
}

ngOnInit(): void {
Expand Down

0 comments on commit da5f436

Please sign in to comment.