38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
describe('VnAccountNumber', () => {
|
|
const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]';
|
|
beforeEach(() => {
|
|
cy.login('developer');
|
|
cy.viewport(1920, 1080);
|
|
cy.visit('/#/supplier/1/fiscal-data');
|
|
});
|
|
|
|
describe('VnInput handleInsertMode()', () => {
|
|
it('should replace character at cursor position in insert mode', () => {
|
|
cy.get(accountInput).type('{selectall}4100000001');
|
|
cy.get(accountInput).type('{movetostart}');
|
|
cy.get(accountInput).type('999');
|
|
cy.get(accountInput).should('have.value', '9990000001');
|
|
});
|
|
|
|
it('should replace character at cursor position in insert mode', () => {
|
|
cy.get(accountInput).clear();
|
|
cy.get(accountInput).type('4100000001');
|
|
cy.get(accountInput).type('{movetostart}');
|
|
cy.get(accountInput).type('999');
|
|
cy.get(accountInput).should('have.value', '9990000001');
|
|
});
|
|
|
|
it('should respect maxlength prop', () => {
|
|
cy.get(accountInput).clear();
|
|
cy.get(accountInput).type('123456789012345');
|
|
cy.get(accountInput).should('have.value', '1234567890');
|
|
});
|
|
});
|
|
|
|
it('should convert short account number to standard format', () => {
|
|
cy.get(accountInput).clear();
|
|
cy.get(accountInput).type('123.');
|
|
cy.get(accountInput).should('have.value', '1230000000');
|
|
});
|
|
});
|