From 7f284a895fceee74ede9d0eefb3c95743285eecf Mon Sep 17 00:00:00 2001 From: Stanslav Zaytsev Date: Thu, 7 Mar 2024 14:35:04 +0300 Subject: [PATCH] test(demo-integrations): moved tests for multi-character-prefix from e2e to ct --- .../multi-character-prefix.cy.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts 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); + }); + }); +});