diff --git a/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts b/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts new file mode 100644 index 000000000..cd5b18f1b --- /dev/null +++ b/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts @@ -0,0 +1,26 @@ +import {maskitoNumberOptionsGenerator} from '@maskito/kit'; + +import {TestInput} from '../utils'; + +describe('multi-character prefix "EUR " (no initial value & no caret guard)', () => { + beforeEach(() => { + cy.mount(TestInput, { + componentProperties: { + maskitoOptions: maskitoNumberOptionsGenerator({ + prefix: 'EUR ', + }), + }, + }); + cy.get('input').focus().should('have.value', '').as('input'); + }); + + ['E', 'U', 'R'].forEach(char => { + it(`Empty input => Type "${char} => Textfield's value is "EUR "`, () => { + cy.get('@input') + .type(char) + .should('have.value', 'EUR ') + .should('have.prop', 'selectionStart', 'EUR '.length) + .should('have.prop', 'selectionEnd', 'EUR '.length); + }); + }); +}); diff --git a/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts b/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts index fad27a6ad..c8ce91a8f 100644 --- a/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts +++ b/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts @@ -313,26 +313,6 @@ describe('Number | Prefix & Postfix', () => { }); }); - describe('multi-character prefix "EUR " (no initial value & no caret guard)', () => { - beforeEach(() => { - cy.visit(DemoPath.Cypress); - cy.get('#multi-character-prefix input') - .focus() - .should('have.value', '') - .as('input'); - }); - - ['E', 'U', 'R'].forEach(char => { - it(`Empty input => Type "${char} => Textfield's value is "EUR "`, () => { - cy.get('@input') - .type(char) - .should('have.value', 'EUR ') - .should('have.prop', 'selectionStart', 'EUR '.length) - .should('have.prop', 'selectionEnd', 'EUR '.length); - }); - }); - }); - describe('prefix ends with the same character as postfix starts', () => { const prefix = 'lbs.​'; // padded with zero-width space