From 0603182baea49a51fc628ec3e01cc3e4ac86bafa Mon Sep 17 00:00:00 2001 From: Dylan Kelly Date: Fri, 12 Jan 2024 15:01:53 +1100 Subject: [PATCH] fix(@dpc-sdp/ripple-tide-search): :white_check_mark: fix failing dependent filter tests --- .../nuxt-app/test/features/search-listing/filters.feature | 3 --- packages/ripple-test-utils/step_definitions/common/mocks.ts | 4 ++++ .../components/global/TideSearchFilterDependent.vue | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/nuxt-app/test/features/search-listing/filters.feature b/examples/nuxt-app/test/features/search-listing/filters.feature index ef5ba80f63..c1046d67ff 100644 --- a/examples/nuxt-app/test/features/search-listing/filters.feature +++ b/examples/nuxt-app/test/features/search-listing/filters.feature @@ -180,7 +180,6 @@ Feature: Search listing - Filter Example: Dependent filter - Should reflect the value from the URL Given the page endpoint for path "/filters" returns fixture "/search-listing/dependent-filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/dependent-filters/response" and status 200 - And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/filters?dependentFilter=Mammals:Dogs,Cats" Then the search listing page should have 2 results @@ -203,8 +202,6 @@ Feature: Search listing - Filter Example: Dependent filter - Child options should update on parent selection Given the page endpoint for path "/filters" returns fixture "/search-listing/dependent-filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/dependent-filters/response" and status 200 - And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" - When I visit the page "/filters" Then the search listing page should have 2 results And the search network request should be called with the "/search-listing/dependent-filters/request-empty" fixture diff --git a/packages/ripple-test-utils/step_definitions/common/mocks.ts b/packages/ripple-test-utils/step_definitions/common/mocks.ts index 944055460c..a17530038d 100644 --- a/packages/ripple-test-utils/step_definitions/common/mocks.ts +++ b/packages/ripple-test-utils/step_definitions/common/mocks.ts @@ -199,3 +199,7 @@ Given('the current date is {string}', (dateString: string) => { Given('the current date is restored', () => { cy.clock().invoke('restore') }) + +Given('time moves {int} second', (sec: number = 1) => { + cy.tick(sec * 1000) +}) diff --git a/packages/ripple-tide-search/components/global/TideSearchFilterDependent.vue b/packages/ripple-tide-search/components/global/TideSearchFilterDependent.vue index 1cc4adb8e0..5978da74f4 100644 --- a/packages/ripple-tide-search/components/global/TideSearchFilterDependent.vue +++ b/packages/ripple-tide-search/components/global/TideSearchFilterDependent.vue @@ -44,8 +44,8 @@ const handleSelect = (value: string) => { if (formNode && initialChild.value) { nextTick(() => { formNode.input({ - 'topic-parent': value, - 'topic-child': initialChild.value + [`${props.id}-parent`]: value, + [`${props.id}-child`]: initialChild.value }) initialChild.value = null })