From 288a50b296b33910d53b81ab8865ad617bf28ba9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 29 Sep 2023 15:03:02 +0200 Subject: [PATCH] ref #6104 fix validations,css and tests --- src/components/common/VnLog.vue | 48 ++++++++++------- test/cypress/integration/vnLog.spec.js | 24 +++------ .../__tests__/components/common/VnLog.spec.js | 51 +++++++++---------- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 27b7c3622..09e580f29 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -373,7 +373,7 @@ function filterFn(val, update, abortFn, type) { const needle = val.toLowerCase(); if (type === 'actions') filteredActions.value = actions.value.filter((item) => - t(`models.${item}`).toLowerCase().includes(needle) + validations[item].locale.name.includes(needle) ); if (type === 'workers') { if (isNaN(needle)) @@ -507,7 +507,7 @@ setLogTree(); flat round :title="t('pointRecord')" - padding="xs" + padding="none" v-if="log.action != 'insert'" @click.stop=" openPointRecord(log.id, modelLog) @@ -571,8 +571,8 @@ setLogTree(); size="sm" @click="log.expand = !log.expand" /> - - + + - - , + - - + @@ -611,8 +611,8 @@ setLogTree(); - - + + {{ log.description }} @@ -678,11 +678,11 @@ setLogTree(); > @@ -943,11 +943,21 @@ setLogTree(); font-size: 0.9rem; } .q-btn { + visibility: hidden; float: right; } } + + &:hover { + .model-info { + .q-btn { + visibility: visible; + } + } + } } .changes-log { + width: 100%; overflow: hidden; &:last-child { @@ -983,11 +993,18 @@ setLogTree(); } } } + .q-btn.pit { + visibility: hidden; + } + &:hover .q-btn.pit { + visibility: visible; + } } & > .change-detail { - background-color: var(--vn-gray); + position: relative; overflow: hidden; text-overflow: ellipsis; + background-color: var(--vn-gray); white-space: nowrap; box-sizing: border-box; & > .q-icon { @@ -1042,11 +1059,6 @@ en: Edits: Edits Deletes: Deletes Accesses: Accesses - models: - Claim: Reclamación - ClaimDms: Documento - ClaimBeginning: Comienzo - ClaimObservation: Observación Users: User: Usuario All: Todo diff --git a/test/cypress/integration/vnLog.spec.js b/test/cypress/integration/vnLog.spec.js index 3d6d9b95d..bf9edb66c 100644 --- a/test/cypress/integration/vnLog.spec.js +++ b/test/cypress/integration/vnLog.spec.js @@ -1,31 +1,21 @@ /// -describe('ClaimNotes', () => { +describe('VnLog', () => { beforeEach(() => { cy.login('developer'); cy.visit(`/#/claim/${1}/log`); - }); - - it('should have just one record', () => { - cy.get('.model-info .q-btn').eq(1).click(); - cy.get('.user-log .model-log').its('length').should('eq', 1); - cy.get('.q-page-sticky .q-btn').click(); - cy.get('.user-log .model-log').its('length').should('eq', 4); + cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); }); it('should filter by insert actions', () => { - cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-checkbox__inner').eq(0).click(); - cy.get('.q-page > .q-drawer-container > .fullscreen').click(); + cy.get('.q-page').click(); cy.get('.model-info .q-chip__content').eq(0).should('have.text', 'Document'); cy.get('.model-info .q-chip__content').eq(1).should('have.text', 'Beginning'); }); - it('should show the point record', () => { - cy.get('.pit').eq(0).click(); - cy.get('.q-menu .q-card .header').should('have.text', 'Observation #1'); - cy.get('.q-menu .q-card .json-string').should( - 'have.text', - 'Waiting for customer' - ); + it('should filter by entity', () => { + cy.get('.q-scrollarea .q-list .q-item .q-select').eq(0).click(); + cy.get('.q-scrollarea .q-list .q-item .q-select').eq(0).type('mien'); + cy.get('[role="listbox"] .q-item').should('have.text', 'Comienzo'); }); }); diff --git a/test/vitest/__tests__/components/common/VnLog.spec.js b/test/vitest/__tests__/components/common/VnLog.spec.js index c818b3398..1fd5b3990 100644 --- a/test/vitest/__tests__/components/common/VnLog.spec.js +++ b/test/vitest/__tests__/components/common/VnLog.spec.js @@ -2,31 +2,30 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; import { createWrapper } from 'app/test/vitest/helper'; import VnLog from 'src/components/common/VnLog.vue'; -const mockValidations = { - Claim: { - locale: { - name: 'reclamación', - }, - }, - ClaimObservation: { - locale: { - name: 'observación', - }, - }, - ClaimDms: { - locale: { - name: 'documento', - }, - }, - ClaimBeginning: { - locale: { - name: 'comienzo', - }, - }, -}; - describe('VnLog', () => { let vm; + const mockValidations = { + Claim: { + locale: { + name: 'reclamación', + }, + }, + ClaimObservation: { + locale: { + name: 'observación', + }, + }, + ClaimDms: { + locale: { + name: 'documento', + }, + }, + ClaimBeginning: { + locale: { + name: 'comienzo', + }, + }, + }; beforeAll(() => { vm = createWrapper(VnLog, { @@ -38,6 +37,7 @@ describe('VnLog', () => { model: 'Claim', }, }).vm; + vm.validations = mockValidations; }); afterEach(() => { @@ -100,7 +100,6 @@ describe('VnLog', () => { }, }, ]; - vm.validations = mockValidations; vm.logTree = vm.getLogs(fakeLogTreeData); expect(vm.logTree[0].originFk).toEqual(1); expect(vm.logTree[0].logs[0].user.name).toEqual('salesPerson'); @@ -121,11 +120,11 @@ describe('VnLog', () => { expect(vm.selectedFilters.action).toEqual({ inq: ['insert', 'update'] }); }); - /*it('should correctly set the date from', () => { + it('should correctly set the date from', () => { vm.date = '18-09-2023'; vm.selectFilter('date', 'from'); expect(vm.selectedFilters.creationDate).toEqual({ between: ['2023-09-18T00:00:00.000Z', '2023-09-18T19:59:59.999Z'], }); - }); */ + }); });