From 4b71dd88b9db4ce64a91a89de461080b4c27a14c Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Thu, 13 Jun 2024 09:01:52 +0200 Subject: [PATCH] chore: add spellcheck to the playground --- packages/_vue3-migration-test/package.json | 2 +- packages/_vue3-migration-test/src/router.ts | 8 +++++++- .../src/x-modules/search/components/index.ts | 1 + .../search/components/test-spellcheck.vue | 20 +++++++++++++++++++ .../src/x-modules/search/x-module.ts | 4 ++-- .../plugins/__tests__/x-plugin-alias.spec.ts | 4 ++-- .../search/components/spellcheck-button.vue | 3 --- .../search/components/spellcheck.vue | 3 --- .../src/x-modules/search/x-module.ts | 3 +++ 9 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 packages/_vue3-migration-test/src/x-modules/search/components/test-spellcheck.vue diff --git a/packages/_vue3-migration-test/package.json b/packages/_vue3-migration-test/package.json index 93bd22ba7c..d59161e8e5 100644 --- a/packages/_vue3-migration-test/package.json +++ b/packages/_vue3-migration-test/package.json @@ -16,7 +16,7 @@ "@vueuse/core": "~10.7.1", "vue": "^3.4.22", "vue-router": "^4.3.0", - "vuex": "^4.1.0" + "vuex": "4.0.2" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.4", diff --git a/packages/_vue3-migration-test/src/router.ts b/packages/_vue3-migration-test/src/router.ts index 7b921ae201..bac8ac2529 100644 --- a/packages/_vue3-migration-test/src/router.ts +++ b/packages/_vue3-migration-test/src/router.ts @@ -28,7 +28,8 @@ import { TestBasePanel, TestBaseKeyboardNavigation, TestBaseEventsModal, - TestBaseIdModal + TestBaseIdModal, + TestSpellcheck } from './'; const routes = [ @@ -176,6 +177,11 @@ const routes = [ path: '/test-base-id-modal', name: 'TestBaseIdModal', component: TestBaseIdModal + }, + { + path: '/test-spellcheck', + name: 'Spellcheck', + component: TestSpellcheck } ]; diff --git a/packages/_vue3-migration-test/src/x-modules/search/components/index.ts b/packages/_vue3-migration-test/src/x-modules/search/components/index.ts index 32ee402482..f49a99f4fc 100644 --- a/packages/_vue3-migration-test/src/x-modules/search/components/index.ts +++ b/packages/_vue3-migration-test/src/x-modules/search/components/index.ts @@ -1,3 +1,4 @@ export { default as TestSortDropdown } from './test-sort-dropdown.vue'; export { default as TestSortList } from './test-sort-list.vue'; export { default as TestSortPickerList } from './test-sort-picker-list.vue'; +export { default as TestSpellcheck } from './test-spellcheck.vue'; diff --git a/packages/_vue3-migration-test/src/x-modules/search/components/test-spellcheck.vue b/packages/_vue3-migration-test/src/x-modules/search/components/test-spellcheck.vue new file mode 100644 index 0000000000..1c6c30bdab --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/search/components/test-spellcheck.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/packages/_vue3-migration-test/src/x-modules/search/x-module.ts b/packages/_vue3-migration-test/src/x-modules/search/x-module.ts index dae572726c..8106bf0557 100644 --- a/packages/_vue3-migration-test/src/x-modules/search/x-module.ts +++ b/packages/_vue3-migration-test/src/x-modules/search/x-module.ts @@ -7,11 +7,11 @@ import { SearchXModule } from '../../../../x-components/src/x-modules/search'; export const searchXModule = { storeModule: { state: { - query: 'dress', results: getResultsStub(10), promoteds: getPromotedsStub(), banners: getBannersStub(), - status: 'success' + status: 'success', + spellcheckedQuery: 'spellcheckedQuery' } } } as PrivateXModuleOptions; diff --git a/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts b/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts index 9a134dc93e..4fe09b77fb 100644 --- a/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts +++ b/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts @@ -51,7 +51,7 @@ describe('testing plugin alias', () => { querySuggestions: undefined, recommendations: undefined, relatedTags: undefined, - search: undefined + search: 'initial' // It is already registered by the `searchXModule` import itself }, device: null, facets: {}, @@ -77,7 +77,7 @@ describe('testing plugin alias', () => { selectedFilters: [], selectedRelatedTags: [], semanticQueries: [], - spellcheckedQuery: null, + spellcheckedQuery: '', // It is already registered by the `searchXModule` import itself totalResults: 0, selectedSort: '' }; diff --git a/packages/x-components/src/x-modules/search/components/spellcheck-button.vue b/packages/x-components/src/x-modules/search/components/spellcheck-button.vue index 543c14fcb2..40d561bb62 100644 --- a/packages/x-components/src/x-modules/search/components/spellcheck-button.vue +++ b/packages/x-components/src/x-modules/search/components/spellcheck-button.vue @@ -15,7 +15,6 @@ import { WireMetadata } from '../../../wiring/wiring.types'; import { searchXModule } from '../x-module'; import { use$x } from '../../../composables/use-$x'; - import { useRegisterXModule } from '../../../composables/use-register-x-module'; import { useState } from '../../../composables/use-state'; /** @@ -29,8 +28,6 @@ name: 'SpellcheckButton', xModule: searchXModule.name, setup() { - useRegisterXModule(searchXModule); - const $x = use$x(); const el = ref(); diff --git a/packages/x-components/src/x-modules/search/components/spellcheck.vue b/packages/x-components/src/x-modules/search/components/spellcheck.vue index 188809f3c6..adbd97f26c 100644 --- a/packages/x-components/src/x-modules/search/components/spellcheck.vue +++ b/packages/x-components/src/x-modules/search/components/spellcheck.vue @@ -7,7 +7,6 @@