From 381a9c6d1d82d3d0c82e88ab674fc53ac5eeaabb Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Jun 2024 13:56:20 +0200 Subject: [PATCH 1/6] feat: remake vnInputDate and fix: FormModel has changes when error --- src/components/FormModel.vue | 10 +- src/components/common/VnInputDate.vue | 150 +++++++++++++------------- 2 files changed, 78 insertions(+), 82 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index f10dee61a..ab9fa921a 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -90,7 +90,7 @@ const $props = defineProps({ }); const emit = defineEmits(['onFetch', 'onDataSaved']); const modelValue = computed( - () => $props.model ?? `formModel_${route?.meta?.title ?? route.name}` + () => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`, ).value; const componentIsRendered = ref(false); const arrayData = useArrayData(modelValue); @@ -137,7 +137,7 @@ onMounted(async () => { JSON.stringify(newVal) !== JSON.stringify(originalData.value); isResetting.value = false; }, - { deep: true } + { deep: true }, ); } }); @@ -145,7 +145,7 @@ onMounted(async () => { if (!$props.url) watch( () => arrayData.store.data, - (val) => updateAndEmit('onFetch', val) + (val) => updateAndEmit('onFetch', val), ); watch(formUrl, async () => { @@ -206,11 +206,11 @@ async function save() { updateAndEmit('onDataSaved', formData.value, response?.data); if ($props.reload) await arrayData.fetch({}); + hasChanges.value = false; } catch (err) { console.error(err); notify('errors.writeRequest', 'negative'); } finally { - hasChanges.value = false; isLoading.value = false; } } @@ -239,7 +239,7 @@ function filter(value, update, filterOptions) { (ref) => { ref.setOptionIndex(-1); ref.moveOptionSelection(1, true); - } + }, ); } diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 77ab2692d..f2c6cbe60 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,13 +1,10 @@ -- 2.40.1 From 52d6eeb9762753ea4249b91f6b67c314c077781a Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 28 Jun 2024 16:22:37 +0200 Subject: [PATCH 2/6] fix: vnSearchBar e2e --- test/cypress/integration/vnSearchBar.spec.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js index f1f3a9e82..75c08825c 100644 --- a/test/cypress/integration/vnSearchBar.spec.js +++ b/test/cypress/integration/vnSearchBar.spec.js @@ -3,13 +3,10 @@ describe('VnSearchBar', () => { const employeeId = ' #1'; const salesPersonId = ' #18'; const idGap = '.q-item > .q-item__label'; - const cardList = '.vn-card-list'; - - let url; + const vnTableRow = '.q-virtual-scroll__content'; beforeEach(() => { cy.login('developer'); cy.visit('#/customer/list'); - cy.url().then((currentUrl) => (url = currentUrl)); }); it('should redirect to customer summary page', () => { @@ -19,12 +16,12 @@ describe('VnSearchBar', () => { it('should stay on the list page if there are several results or none', () => { cy.writeSearchbar('salesA{enter}'); - checkCardListAndUrl(2); + checkTableLength(2); cy.clearSearchbar(); cy.writeSearchbar('0{enter}'); - checkCardListAndUrl(0); + checkTableLength(0); }); const searchAndCheck = (searchTerm, expectedText) => { @@ -33,10 +30,7 @@ describe('VnSearchBar', () => { cy.get(idGap).should('have.text', expectedText); }; - const checkCardListAndUrl = (expectedLength) => { - cy.get(cardList).then(($cardList) => { - expect($cardList.find('.q-card').length).to.equal(expectedLength); - cy.url().then((currentUrl) => expect(currentUrl).to.contain(url)); - }); + const checkTableLength = (expectedLength) => { + cy.get(vnTableRow).find('tr').should('have.length', expectedLength) }; }); -- 2.40.1 From f4975d1f157d908edf2b73aa6fe8cde972c28212 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 1 Jul 2024 09:00:45 +0200 Subject: [PATCH 3/6] fix: ticketFilter adapt VnInputDate --- src/components/common/VnInputDate.vue | 25 ++++++++++++++++++------- src/pages/Ticket/TicketFilter.vue | 15 +-------------- src/pages/Ticket/TicketList.vue | 4 ++-- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index f2c6cbe60..60fd67c0f 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,5 +1,5 @@ @@ -81,7 +92,7 @@ const popupDate = computed(() => - +