#8718 hotfix-supplierSection #1549

Merged
jorgep merged 6 commits from 8718-hotfix-supplierSection into master 2025-03-05 07:54:55 +00:00
3 changed files with 41 additions and 30 deletions
Showing only changes of commit d4a18e5846 - Show all commits

View File

@ -29,7 +29,6 @@ async function handleUpdateModel(val) {
<VnInput
Review

Las funciones que he borrado, ya las tiene vnInput, así no duplicamos código

Las funciones que he borrado, ya las tiene vnInput, así no duplicamos código
v-model="model"
ref="inputRef"
v-bind="$attrs"
:insertable
@update:model-value="handleUpdateModel"
/>

View File

@ -143,7 +143,7 @@ const handleUppercase = () => {
:rules="mixinRules"
:lazy-rules="true"
hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
Review

Así no funciona

Así no funciona
:data-cy="$attrs['data-cy'] ?? $attrs.label + '_input'"
>
<template #prepend v-if="$slots.prepend">
<slot name="prepend" />

View File

@ -1,4 +1,4 @@
describe('VnInput Component', () => {
describe('VnAccountNumber', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
@ -6,34 +6,46 @@ describe('VnInput Component', () => {
cy.domContentLoad();
});
it('should replace character at cursor position in insert mode', () => {
// Simula escribir en el input
cy.dataCy('supplierFiscalDataAccount').clear();
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
// Coloca el cursor en la posición 0
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente
cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount')
.should('have.value', '9990000001');
describe('VnInput handleInsertMode()', () => {
Review

Queda más claro así

Queda más claro así
it('should replace character at cursor position in insert mode', () => {
cy.get('input[data-cy="supplierFiscalDataAccount"]').type(
'{selectall}4100000001',
);
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('{movetostart}');
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('999');
cy.get('input[data-cy="supplierFiscalDataAccount"]').should(
'have.value',
'9990000001',
);
});
it('should replace character at cursor position in insert mode', () => {
cy.get('input[data-cy="supplierFiscalDataAccount"]').clear();
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('4100000001');
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('{movetostart}');
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('999');
cy.get('input[data-cy="supplierFiscalDataAccount"]').should(
'have.value',
'9990000001',
);
});
it('should respect maxlength prop', () => {
cy.get('input[data-cy="supplierFiscalDataAccount"]').clear();
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('123456789012345');
cy.get('input[data-cy="supplierFiscalDataAccount"]').should(
'have.value',
'1234567890',
);
});
});
it('should replace character at cursor position in insert mode', () => {
// Simula escribir en el input
cy.dataCy('supplierFiscalDataAccount').clear();
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
// Coloca el cursor en la posición 0
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente en la posicion incial
cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount')
.should('have.value', '9990000001');
});
it('should respect maxlength prop', () => {
cy.dataCy('supplierFiscalDataAccount').clear();
cy.dataCy('supplierFiscalDataAccount').type('123456789012345');
cy.dataCy('supplierFiscalDataAccount')
.should('have.value', '1234567890'); // asumiendo que maxlength es 10
it('should convert short account number to standard format', () => {
cy.get('input[data-cy="supplierFiscalDataAccount"]').clear();
cy.get('input[data-cy="supplierFiscalDataAccount"]').type('123.');
cy.get('input[data-cy="supplierFiscalDataAccount"]').should(
'have.value',
'1230000000',
);
});
});