Skip to content

Commit

Permalink
refactor(demo-integrations): added using constants in CT
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanslav Zaytsev committed Mar 4, 2024
1 parent e8ec10a commit 9c0efc6
Showing 1 changed file with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
import {CHAR_EN_DASH, CHAR_HYPHEN, CHAR_JP_HYPHEN} from 'projects/kit/src/lib/constants';

import {openNumberPage} from './utils';

describe('Properly using custom minus sign', () => {
describe('correctly applies \u002D as minus sign', () => {
describe(`correctly applies ${CHAR_HYPHEN} as minus sign`, () => {
beforeEach(() => {
openNumberPage('minusSign=\u002D');
openNumberPage('minusSign=\u002D&thousandSeparator=_');
});

it('-32412 => \u002D32 412', () => {
cy.get('@input').type('-32412').should('have.value', '\u002D32 412');
it(`-32412 => ${CHAR_HYPHEN}32_412`, () => {
cy.get('@input').type('-32412').should('have.value', `${CHAR_HYPHEN}32_412`);
});

it('\u002D32412 => \u002D32 412', () => {
cy.get('@input').type('-32412').should('have.value', '\u002D32 412');
it(`${CHAR_HYPHEN}32412 => ${CHAR_HYPHEN}32_412`, () => {
cy.get('@input').type('-32412').should('have.value', `${CHAR_HYPHEN}32_412`);
});

it('\u30FC32412 => \u002D32 412', () => {
cy.get('@input').type('\u30FC32412').should('have.value', '\u002D32 412');
it(`${CHAR_JP_HYPHEN}32412 => ${CHAR_HYPHEN}32_412`, () => {
cy.get('@input')
.type(`${CHAR_JP_HYPHEN}32412`)
.should('have.value', `${CHAR_HYPHEN}32_412`);
});

it('\u201332412 => \u002D32 412', () => {
cy.get('@input').type('\u201332412').should('have.value', '\u002D32 412');
it(`${CHAR_EN_DASH}32412 => ${CHAR_HYPHEN}32_412`, () => {
cy.get('@input')
.type(`${CHAR_EN_DASH}32412`)
.should('have.value', `${CHAR_HYPHEN}32_412`);
});
});

describe('correctly works with decimal, and minus sign is i', () => {
beforeEach(() => {
openNumberPage('minusSign=i&precision=Infinity');
openNumberPage('minusSign=i&precision=Infinity&thousandSeparator=_');
});

it('-324,12 => i324.12', () => {
cy.get('@input').type('-324,12').should('have.value', 'i 324.12');
it('-324,12 => i_324.12', () => {
cy.get('@input').type('-324,12').should('have.value', 'i_324.12');
});

it('\u002D324,12 => i324.12', () => {
cy.get('@input').type('\u002D324,12').should('have.value', 'i 324.12');
it(`${CHAR_HYPHEN}324,12 => i_324.12`, () => {
cy.get('@input')
.type(`${CHAR_HYPHEN}324,12`)
.should('have.value', 'i_324.12');
});

it('\u30FC324,12 => i324.12', () => {
cy.get('@input').type('\u30FC324,12').should('have.value', 'i 324.12');
it(`${CHAR_JP_HYPHEN}324,12 => i_324.12`, () => {
cy.get('@input')
.type(`${CHAR_JP_HYPHEN}324,12`)
.should('have.value', 'i_324.12');
});

it('\u2013324,12 => i324.12', () => {
cy.get('@input').type('\u2013324,12').should('have.value', 'i 324.12');
it(`${CHAR_EN_DASH}324,12 => i_324.12`, () => {
cy.get('@input')
.type(`${CHAR_EN_DASH}324,12`)
.should('have.value', 'i_324.12');
});
});
});

0 comments on commit 9c0efc6

Please sign in to comment.