Skip to content

Commit

Permalink
Merge pull request #1200 from dpc-sdp/feature/multiple-result-compone…
Browse files Browse the repository at this point in the history
…nt-support

feat(@dpc-sdp/ripple-tide-search): allow multiple result items types
  • Loading branch information
dylankelly authored Jun 3, 2024
2 parents 4de1afc + ae054e8 commit bba7667
Show file tree
Hide file tree
Showing 8 changed files with 918 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Result items

Background:
Given the site endpoint returns fixture "/site/reference" with status 200
And I am using a "macbook-16" device

@mockserver
Example: Result item type can be set per result
Given the page endpoint for path "/search-results" returns fixture "/search-listing/result-items/page" with status 200
And the search network request is stubbed with fixture "/search-listing/result-items/response" and status 200

When I visit the page "/search-results"
Then the search listing page should have 4 results
Then the search listing results should have following items:
| title | component |
| International conference | tide-event-search-result |
| Accessibility guidelines | tide-search-result-card |
| Small business grant | tide-grant-search-result |
| GovHack 2022 is coming | tide-search-result |
151 changes: 151 additions & 0 deletions examples/nuxt-app/test/fixtures/search-listing/result-items/page.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"title": "Search results",
"changed": "2024-06-03T01:12:18+00:00",
"created": "2024-06-02T23:33:24+00:00",
"type": "tide_search_listing",
"nid": "fbcaaa5d-1635-40ac-8e44-2ed826177e77",
"_sectionId": "4",
"sidebar": {},
"status": "published",
"topicTags": [],
"siteSection": null,
"meta": {
"langcode": "en",
"description": "",
"additional": [
{
"tag": "meta",
"attributes": {
"name": "title",
"content": "Search results | Victorian Government"
}
},
{
"tag": "link",
"attributes": {
"rel": "canonical",
"href": "https://develop.content.vic.gov.au/test-sl"
}
},
{
"tag": "meta",
"attributes": {
"property": "og:locale",
"content": "en-AU"
}
}
],
"keywords": "",
"image": null
},
"showContentRating": true,
"summary": null,
"beforeResults": "",
"afterResults": "",
"introText": null,
"config": {
"searchListingConfig": {
"hideSearchForm": false,
"resultsPerPage": 20,
"labels": {
"submit": "Submit search",
"placeholder": "Start typing search term..."
},
"customSort": [
{
"title.keyword": "asc"
}
],
"formTheme": "default"
},
"queryConfig": {
"multi_match": {
"query": "{{query}}",
"fields": [
"title^3",
"field_landing_page_summary^2",
"body",
"field_paragraph_body",
"summary_processed"
]
}
},
"globalFilters": [
{
"terms": {
"type": [
"news",
"grant",
"event",
"landing_page"
]
}
},
{
"terms": {
"field_node_site": [
8888
]
}
}
],
"userFilters": [
{
"id": "type",
"component": "TideSearchFilterDropdown",
"filter": {
"type": "terms",
"value": "type"
},
"props": {
"id": "type",
"label": "Type",
"placeholder": "Select a type",
"type": "RplFormDropdown",
"multiple": true,
"options": [
{
"id": "news",
"label": "News",
"value": "news"
},
{
"id": "grant",
"label": "Grant",
"value": "grant"
},
{
"id": "event",
"label": "Event",
"value": "event"
},
{
"id": "landing_page",
"label": "Landing Page",
"value": "landing_page"
}
]
}
}
],
"resultsConfig": {
"layout": {
"component": "TideSearchResultsList"
},
"item": {
"news": {
"component": "TideSearchResult"
},
"event": {
"component": "TideEventSearchResult"
},
"grant": {
"component": "TideGrantSearchResult"
},
"*": {
"component": "TideSearchResultCard"
}
}
}
}
}
Loading

0 comments on commit bba7667

Please sign in to comment.