feat: refs #8388 add filter options for intrastat table columns and update tests for row operations
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-05-15 14:38:27 +02:00
parent 79e87833b9
commit cf64b7069b
2 changed files with 24 additions and 21 deletions

View File

@ -27,6 +27,7 @@ const columns = computed(() => [
'data-cy': 'intrastat-code',
sortBy: 'id',
fields: ['id', 'description'],
filterOptions: ['id', 'description']
},
format: (row, dashIfEmpty) => dashIfEmpty(getCode(row)),
create: true,

View File

@ -1,36 +1,38 @@
/// <reference types="cypress" />
describe('InvoiceInIntrastat', () => {
const firstRow = 'tbody > :nth-child(1)';
const thirdRow = 'tbody > :nth-child(3)';
const codes = `[data-cy="intrastat-code"]`;
const firstRowAmount = `${firstRow} > :nth-child(3)`;
const firstInstrastat = 'td[data-col-field="intrastatFk"][data-row-index="0"]';
const firstAmount = 'td[data-col-field="amount"][data-row-index="0"]';
const intrastat = 'Plantas vivas: Esqueje/injerto, Vid';
beforeEach(() => {
cy.login('administrative');
cy.visit(`/#/invoice-in/1/intrastat`);
});
it('should edit the first line', () => {
cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(firstRowAmount).clear();
cy.get(firstInstrastat).click().type(`{selectall}{backspace}${intrastat}{enter}`);
cy.get(firstAmount).click().type('10{selectall}{backspace}20{enter}');
cy.saveCard();
cy.get(codes)
.eq(0)
.should('have.value', '6021010: Plantas vivas: Esqueje/injerto, Vid');
cy.get(firstInstrastat).should('have.text', `6021010: ${intrastat}`);
});
it('should add a new row', () => {
cy.addRow();
cy.fillRow(thirdRow, [
false,
'Plantas vivas: Esqueje/injerto, Vid',
30,
10,
5,
'FR',
]);
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.dataCy('vnTableCreateBtn').click();
cy.fillInForm(
{
'intrastat-code': {
val: 'Plantas vivas: Esqueje/injerto, Vid',
type: 'select',
},
Amount_input: '30',
Net_input: '10',
Stems_input: '5',
Country_select: { val: 'FR', type: 'select' },
},
{ attr: 'data-cy' },
);
cy.dataCy('FormModelPopup_save').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
});
it('should remove the first line', () => {