From 46af9299679273e3dbb3992588e37afa6173cc38 Mon Sep 17 00:00:00 2001 From: Nikita Barsukov Date: Wed, 9 Oct 2024 15:39:17 +0300 Subject: [PATCH] chore(demo-integrations): some new tests --- .../src/tests/kit/time/time-meridiem.cy.ts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts b/projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts index 962c0c539..5057832c9 100644 --- a/projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts +++ b/projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts @@ -179,6 +179,53 @@ describe('Time | modes with meridiem', () => { }); }); + describe('press any characters (except part of meridiem ones) when cursor is placed near already existing meridiem', () => { + beforeEach(() => { + cy.get('@textfield') + .type('1234a') + .should('have.value', '12:34 AM') + .should('have.prop', 'selectionStart', '12:34 AM'.length) + .should('have.prop', 'selectionEnd', '12:34 AM'.length); + }); + + it('12:34 AM| => Press 1 => Nothing changed', () => { + cy.get('@textfield') + .type('{moveToEnd}') + .type('1') + .should('have.value', '12:34 AM') + .should('have.prop', 'selectionStart', '12:34 AM'.length) + .should('have.prop', 'selectionEnd', '12:34 AM'.length); + }); + + it('12:34 A|M => Press 1 => Nothing changed', () => { + cy.get('@textfield') + .type('{moveToEnd}{leftArrow}') + .type('1') + .should('have.value', '12:34 AM') + .should('have.prop', 'selectionStart', '12:34 A'.length) + .should('have.prop', 'selectionEnd', '12:34 A'.length); + }); + + it('12:34 A|M => Press T => Nothing changed', () => { + cy.get('@textfield') + .type('{moveToEnd}{leftArrow}') + .type('t') + .should('have.value', '12:34 AM') + .should('have.prop', 'selectionStart', '12:34 A'.length) + .should('have.prop', 'selectionEnd', '12:34 A'.length); + }); + + it('12:34 |AM => Press T => Nothing changed', () => { + cy.get('@textfield') + .type('{moveToEnd}') + .type('{leftArrow}'.repeat(2)) + .type('t') + .should('have.value', '12:34 AM') + .should('have.prop', 'selectionStart', '12:34 '.length) + .should('have.prop', 'selectionEnd', '12:34 '.length); + }); + }); + describe('hour segment bounds', () => { it('cannot be less than 01 (rejects zero as the 2nd hour segment)', () => { cy.get('@textfield')