Skip to content

Commit

Permalink
Merge pull request #1153 from dpc-sdp/bugfix/R20-1981-listing-aggrega…
Browse files Browse the repository at this point in the history
…tions

[R20-1981] fix search listing dropdowns
  • Loading branch information
dylankelly authored May 8, 2024
2 parents 2b6fb99 + 9d0b0bd commit d84d90f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Feature: Search listing - Aggregations
Example: Aggregations and Taxonomies
Given the page endpoint for path "/aggregations" returns fixture "/search-listing/aggregations/page" with status 200
And the search network request is stubbed with fixture "/search-listing/aggregations/response" and status 200
And the current date is "Fri, 02 Feb 2050 03:04:05 GMT"

When I visit the page "/aggregations"
Then the search listing page should have 2 results
Expand All @@ -26,6 +25,7 @@ Feature: Search listing - Aggregations
| Government |
| Individual |
| Not-for-profit groups |
And I click the option labelled "Business" in the selected dropdown
# Close the dropdown
When I click the search listing dropdown field labelled "Elastic aggregation test"

Expand All @@ -34,3 +34,11 @@ Feature: Search listing - Aggregations
Then the selected dropdown field should have the items:
| Arts |
| Business |
And I click the option labelled "Arts" in the selected dropdown
And I click the search listing dropdown field labelled "Taxonomy test"

When I submit the search filters
Then the URL should reflect that the current active filters are as follows:
| id | value |
| audience | Business |
| topic | Arts |
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ onAggregationUpdateHook.value = (aggs: any) => {
if (uiFilter.id === key) {
const getDynamicOptions = () => {
const mappedOptions = aggs[key].map((item: any) => ({
id: item,
label: item,
value: item
id: item.key,
label: item.key,
value: item.key
}))
if (uiFilters.value[idx].props?.hasOwnProperty('options')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ripple-tide-search/composables/useTideSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default ({
field: currentFilter.aggregations.field,
order: { _key: 'asc' },
size: currentFilter.aggregations.size || 30,
min_doc_count: 0
min_doc_count: searchListingConfig?.dynamicAggregations ? 0 : 1
}
}
}
Expand Down

0 comments on commit d84d90f

Please sign in to comment.