diff --git a/cypress.config.js b/cypress.config.js index 1934f833e..e2046d6c4 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -3,6 +3,7 @@ const { defineConfig } = require('cypress'); module.exports = defineConfig({ e2e: { baseUrl: 'http://localhost:9000/', + experimentalStudio: true, fixturesFolder: 'test/cypress/fixtures', screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', diff --git a/src/App.vue b/src/App.vue index d0d8c9358..27cc34c38 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,7 +16,7 @@ onMounted(() => { if (availableLocales.includes(userLang)) { locale.value = userLang; } else { - locale.value = fallbackLocale; + locale.value = fallbackLocale.value; } }); diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index 47836c05b..02e84849c 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -28,8 +28,23 @@ const countriesOptions = ref([]); const provincesOptions = ref([]); const townsLocationOptions = ref([]); -const onDataSaved = (dataSaved) => { - emit('onDataSaved', dataSaved); +const onDataSaved = (formData) => { + const newPostcode = { + ...formData + }; + const townObject = townsLocationOptions.value.find( + ({id}) => id === formData.townFk + ); + newPostcode.town = townObject?.name; + const provinceObject = provincesOptions.value.find( + ({id}) => id === formData.provinceFk + ); + newPostcode.province = provinceObject?.name; + const countryObject = countriesOptions.value.find( + ({id}) => id === formData.countryFk + ); + newPostcode.country = countryObject?.country; + emit('onDataSaved', newPostcode); }; const onCityCreated = async ({ name, provinceFk }, formData) => { @@ -73,7 +88,7 @@ const onProvinceCreated = async ({ name }, formData) => { :title="t('New postcode')" :subtitle="t('Please, ensure you put the correct data!')" :form-initial-data="postcodeFormData" - @on-data-saved="onDataSaved($event)" + @on-data-saved="onDataSaved" > diff --git a/src/components/ui/VnSubToolbar.vue b/src/components/ui/VnSubToolbar.vue index 018447057..22eebdf36 100644 --- a/src/components/ui/VnSubToolbar.vue +++ b/src/components/ui/VnSubToolbar.vue @@ -14,7 +14,7 @@ onUnmounted(() => { +