fix: refs #8583 basicData e2e

This commit is contained in:
Carlos Satorres 2025-02-25 14:24:31 +01:00
parent e318a46279
commit 9366713e9b
2 changed files with 8 additions and 19 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -8,7 +8,6 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary'; import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
import { getDifferences, getUpdatedValues } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const form = ref(); const form = ref();
@ -18,11 +17,11 @@ const maritalStatus = [
{ code: 'M', name: t('Married') }, { code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') }, { code: 'S', name: t('Single') },
]; ];
function onBeforeSave(formData, originalData) { async function setAdvancedSummary(data) {
return getUpdatedValues( const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
Object.keys(getDifferences(formData, originalData)), Object.assign(form.value.formData, advanced);
formData, await nextTick();
); if (form.value) form.value.hasChanges = false;
} }
</script> </script>
<template> <template>
@ -43,7 +42,7 @@ function onBeforeSave(formData, originalData) {
:url-update="`Workers/${$route.params.id}`" :url-update="`Workers/${$route.params.id}`"
auto-load auto-load
model="Worker" model="Worker"
:mapper="onBeforeSave" @on-fetch="setAdvancedSummary"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>

View File

@ -8,19 +8,9 @@ describe('WorkerBasicData', () => {
cy.visit('/#/worker/1107/basic-data'); cy.visit('/#/worker/1107/basic-data');
}); });
it('should load worker summary', () => { it('should modify worker summary', () => {
cy.get(maritalStatusSelect).type('Married'); cy.get(maritalStatusSelect).type('Married');
cy.get(fi).type(nif); cy.get(fi).type(nif);
cy.saveCard(); cy.saveCard();
}); });
// it('should try descriptors', () => {
// cy.waitForElement('.summaryHeader');
// cy.get(departmentDescriptor).click();
// cy.get('.descriptor').should('be.visible');
// cy.get('.q-item > .q-item__label').should('include.text', '43');
// cy.get(roleDescriptor).click();
// cy.get('.descriptor').should('be.visible');
// cy.get('.q-item > .q-item__label').should('include.text', '19');
// });
}); });