52 lines
2.1 KiB
JavaScript
52 lines
2.1 KiB
JavaScript
describe('VnAccountNumber', () => {
|
|
beforeEach(() => {
|
|
cy.login('developer');
|
|
cy.viewport(1920, 1080);
|
|
cy.visit('/#/supplier/1/fiscal-data');
|
|
cy.domContentLoad();
|
|
});
|
|
|
|
describe('VnInput handleInsertMode()', () => {
|
|
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 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',
|
|
);
|
|
});
|
|
});
|