Skip to content

Commit

Permalink
refactor(demo-integrations): rewriting e2e tests to CT(multi-characte…
Browse files Browse the repository at this point in the history
…r-prefix tests) (#1130)
  • Loading branch information
KrollikRoddzer authored Mar 7, 2024
1 parent a6f7bc9 commit b2e522a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b2e522a

Please sign in to comment.