fix: refs #8583 basicData e2e
This commit is contained in:
parent
e318a46279
commit
9366713e9b
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.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 VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
|
||||
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
const form = ref();
|
||||
|
@ -18,11 +17,11 @@ const maritalStatus = [
|
|||
{ code: 'M', name: t('Married') },
|
||||
{ code: 'S', name: t('Single') },
|
||||
];
|
||||
function onBeforeSave(formData, originalData) {
|
||||
return getUpdatedValues(
|
||||
Object.keys(getDifferences(formData, originalData)),
|
||||
formData,
|
||||
);
|
||||
async function setAdvancedSummary(data) {
|
||||
const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
|
||||
Object.assign(form.value.formData, advanced);
|
||||
await nextTick();
|
||||
if (form.value) form.value.hasChanges = false;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -43,7 +42,7 @@ function onBeforeSave(formData, originalData) {
|
|||
:url-update="`Workers/${$route.params.id}`"
|
||||
auto-load
|
||||
model="Worker"
|
||||
:mapper="onBeforeSave"
|
||||
@on-fetch="setAdvancedSummary"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
|
@ -8,19 +8,9 @@ describe('WorkerBasicData', () => {
|
|||
cy.visit('/#/worker/1107/basic-data');
|
||||
});
|
||||
|
||||
it('should load worker summary', () => {
|
||||
it('should modify worker summary', () => {
|
||||
cy.get(maritalStatusSelect).type('Married');
|
||||
cy.get(fi).type(nif);
|
||||
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');
|
||||
// });
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue