Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Ignore search value in filter reset button #1065

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading