Skip to content

Commit

Permalink
chore(demo-integrations): some new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov committed Oct 9, 2024
1 parent 78f6c56 commit 46af929
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 46af929

Please sign in to comment.