fix: refs #6317 validation % fix e2e
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-02-19 10:56:47 +01:00
parent 154f8ca477
commit c6e9ae2c5f
4 changed files with 8 additions and 13 deletions

View File

@ -2,7 +2,6 @@
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useCapitalize } from 'src/composables/useCapitalize';
import { useValidNumber } from 'src/composables/useValidNumber';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
@ -19,15 +18,16 @@ const amount = computed({
return props.modelValue;
},
set(val) {
emit('update:modelValue', val.replaceAll(',', '.'));
emit('update:modelValue', val);
},
});
</script>
<template>
<VnInput
v-model="amount"
type="number"
step="any"
:label="useCapitalize(t('amount'))"
:rules="[(val) => useValidNumber(val) || !val]"
is-outlined
>
<template #prepend v-if="icon">
@ -35,11 +35,6 @@ const amount = computed({
</template>
</VnInput>
</template>
<style lang="scss" scoped>
.q-input {
max-height: 44px;
}
</style>
<i18n>
es:
amount: importe

View File

@ -1,3 +0,0 @@
export function useValidNumber(value) {
return /^(\d|\d+(\.)?\d+)$/.test(value);
}

View File

@ -8,6 +8,7 @@ import { useArrayData } from 'src/composables/useArrayData';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
const route = useRoute();
const { t } = useI18n();
@ -158,9 +159,9 @@ async function insert() {
</template>
<template #body-cell-amount="{ row }">
<QTd>
<QInput
<VnCurrency
v-model="row.amount"
type="number"
:is-outlined="false"
clearable
clear-icon="close"
/>

View File

@ -5,10 +5,12 @@ describe('InvoiceInList', () => {
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header';
const screen = '.q-page-container > .q-drawer-container > .fullscreen';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/invoice-in/list`);
cy.get(screen).click();
});
it('should redirect on clicking a invoice', () => {