0
0
Fork 0

fix: refs #6942 tests & summary table spacing

This commit is contained in:
Jorge Penadés 2024-05-28 13:11:38 +02:00
parent 5aa3b14014
commit 3b3e7e7e03
4 changed files with 14 additions and 53 deletions

View File

@ -346,7 +346,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
}}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{
<QTd class="text-center">{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
@ -361,6 +361,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #header="dueDayProps">
<QTr :props="dueDayProps" class="bg">
<QTh
table-header-style="max-width:50%"
v-for="col in dueDayProps.cols"
:key="col.name"
:props="dueDayProps"
@ -425,22 +426,15 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
.summaryBody {
.vat {
flex: 65%;
table th {
&:nth-child(5) {
padding: 0;
}
&:last-child {
padding: 0;
}
}
}
.due-day {
flex: 30%;
table th {
&:last-child {
padding: 0;
}
.vat,
.due-day {
.q-table th {
padding-right: 0;
}
}
}

View File

@ -1,6 +1,6 @@
<script setup>
import { ref, computed } from 'vue';
import { useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
@ -11,13 +11,13 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import CrudModel from 'src/components/CrudModel.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
const { currentRoute } = useRouter();
const router = useRoute();
const { t } = useI18n();
const quasar = useQuasar();
const arrayData = useArrayData(currentRoute.value.meta.moduleName);
const arrayData = useArrayData(router.meta.moduleName);
const invoiceIn = computed(() => arrayData.store.data);
const invoiceId = +currentRoute.value.params.id;
const invoiceId = +router.params.id;
const currency = computed(() => invoiceIn.value?.currency?.code);
const expenses = ref([]);
const sageTaxTypes = ref([]);

View File

@ -1,5 +1,5 @@
import { vi, describe, expect, it, beforeAll } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import InvoiceInVat from 'src/pages/InvoiceIn/Card/InvoiceInVat.vue';
describe('InvoiceInVat', () => {
@ -16,41 +16,6 @@ describe('InvoiceInVat', () => {
}).vm;
});
describe('addExpense()', () => {
beforeAll(() => {
vi.spyOn(axios, 'post').mockResolvedValue({ data: [] });
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
vi.spyOn(vm.quasar, 'notify');
});
it('should throw an error when the code property is undefined', async () => {
await vm.addExpense();
expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({
message: `The code can't be empty`,
type: 'negative',
})
);
});
it('should correctly handle expense addition', async () => {
vm.newExpense = {
code: 123,
isWithheld: false,
description: 'Descripción del gasto',
};
await vm.addExpense();
expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({
message: 'Data saved',
type: 'positive',
})
);
});
});
describe('taxRate()', () => {
it('should correctly compute the tax rate', () => {
const invoiceInTax = { taxableBase: 100, taxTypeSageFk: 1 };

View File

@ -24,6 +24,7 @@ vi.mock('vue-router', () => ({
params: {
id: 1,
},
meta: { moduleName: 'mockName' },
},
},
}),
@ -31,6 +32,7 @@ vi.mock('vue-router', () => ({
matched: [],
query: {},
params: {},
meta: { moduleName: 'mockName' },
}),
}));