From c365682e3c032ee3969edcd5b4af627108786fc0 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 24 Aug 2023 15:05:31 +0200 Subject: [PATCH] refs #5673 fix: crudModel and finish e2e --- src/components/CrudModel.vue | 5 ++- src/components/FormModel.vue | 8 +++-- src/components/common/VnSelectFilter.vue | 15 ++++++-- src/components/ui/VnPaginate.vue | 1 + src/composables/useValidator.js | 21 +++++------ src/pages/Claim/Card/ClaimLines.vue | 2 +- .../integration/claimDevelopment.spec.js | 14 -------- .../components/common/CrudModel.spec.js | 35 ++++++++++--------- .../__tests__/pages/Claims/ClaimLines.spec.js | 3 ++ 9 files changed, 53 insertions(+), 51 deletions(-) diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 13e8ca3e3..17b21b0e6 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -98,8 +98,7 @@ async function fetch(data) { } function reset() { - state.set($props.model, originalData.value); - watch(formData.value, () => (hasChanges.value = true)); + fetch(originalData.value); hasChanges.value = false; } // eslint-disable-next-line vue/no-dupe-keys @@ -317,7 +316,7 @@ function isEmpty(obj) { diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 28a3759b8..540c37d01 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -89,7 +89,11 @@ async function save() { function reset() { state.set($props.model, originalData.value); + originalData.value = JSON.parse(JSON.stringify(originalData.value)); + watch(formData.value, () => (hasChanges.value = true)); + + emit('onFetch', state.get($props.model)); hasChanges.value = false; } // eslint-disable-next-line vue/no-dupe-keys @@ -123,7 +127,7 @@ watch(formUrl, async () => {
- + { :disable="!hasChanges" :title="t('globals.save')" /> - +
diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index 2fc8ce4ad..95150cadc 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -1,5 +1,5 @@