Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kit): Time & DateTime support increment / decrement of time segment via ArrowUp / ArrowDown #1223

Merged
merged 43 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5a2181f
feat(kit): created plugin for time stepping
KrollikRoddzer May 6, 2024
8ab92ff
feat(kit): added step parameter for time-mask
KrollikRoddzer May 6, 2024
ee9ade5
docs(demo): added step to time api
KrollikRoddzer May 6, 2024
4650d42
feat(kit): added timeStep and plugin for arrows in datetime, added to…
KrollikRoddzer May 6, 2024
dcddc23
test(demo-integrations): time-step
KrollikRoddzer May 7, 2024
f529ecc
test(demo-integrations): date-time-time-segmants
KrollikRoddzer May 8, 2024
edb041f
feat(kit): now stepping works when step is positive
KrollikRoddzer May 8, 2024
5891371
test(demo-integrations): added tests for disabled
KrollikRoddzer May 8, 2024
70c5d38
docs(demo): time steping
KrollikRoddzer May 8, 2024
a62f583
docs(demo): added docs for timeStep
KrollikRoddzer May 8, 2024
a564f89
docs(demo): added full description for step and timeStep
KrollikRoddzer May 8, 2024
de6cfff
chore: apply changes after linting [bot]
taiga-family-bot May 8, 2024
320fe1d
refactor(kit): applied review changes
KrollikRoddzer May 15, 2024
e245997
refactor(kit): removed min values for time
KrollikRoddzer May 17, 2024
b28428f
refactor(kit): applied review changes
KrollikRoddzer May 17, 2024
6557d60
refactor(kit): applied review comments
KrollikRoddzer May 17, 2024
151f67e
docs(demo): changed docs
KrollikRoddzer May 17, 2024
12523dd
docs(demo): changed docs
KrollikRoddzer May 17, 2024
d2d8462
docs(demo): changed docs
KrollikRoddzer May 17, 2024
ed79180
docs(demo): changed docs
KrollikRoddzer May 17, 2024
8baf6fe
docs(demo): changed docs
KrollikRoddzer May 17, 2024
452d558
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
8833423
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
776a8df
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
3d8a98a
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
e9f0260
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
fab5d84
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
d861ca3
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
2046cfd
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
ccc2a59
chore: apply changes after linting [bot]
taiga-family-bot May 17, 2024
fd87bf3
test(demo-integrations): refactored tests
KrollikRoddzer May 17, 2024
74a21cd
test(demo-integrations): applied review changes
KrollikRoddzer May 17, 2024
6bf5e28
docs(demo): changed docs
KrollikRoddzer May 17, 2024
383fece
docs(demo): changed docs
KrollikRoddzer May 17, 2024
6d5da6c
docs(demo): changed docs
KrollikRoddzer May 17, 2024
1b2255e
docs(demo): changed docs
KrollikRoddzer May 17, 2024
2039f21
docs(demo): changed docs
KrollikRoddzer May 17, 2024
a12c786
docs(demo): changed docs
KrollikRoddzer May 17, 2024
605c6fa
chore: apply changes after linting [bot]
taiga-family-bot May 17, 2024
1298fe4
docs(demo): changed example for date time
KrollikRoddzer May 17, 2024
64b987c
feat(kit): added craetTimeStepping plugin to module import
KrollikRoddzer May 17, 2024
4f37336
feat(kit): added max segment values param for createTimeSteppingPlugin
KrollikRoddzer May 17, 2024
cffda89
chore: apply review suggestion
nsbarsukov May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import {DemoPath} from '@demo/constants';
import {BROWSER_SUPPORTS_REAL_EVENTS} from 'projects/demo-integrations/src/support/constants';

describe('DateTime | timeStep', () => {
describe('yy/mm;HH:MM:SS.MSS', () => {
describe('timeStep = 1, initial state = 22.12;', () => {
beforeEach(() => {
cy.visit(
`/${DemoPath.DateTime}/API?dateTimeSeparator=;&dateMode=yy%2Fmm&timeStep=1&timeMode=HH:MM:SS.MSS`,
);
cy.get('#demo-content input')
.should('be.visible')
.first()
.focus()
.as('input');

cy.get('@input')
.type('2212.')
.should('have.value', '22.12;')
.should('have.a.prop', 'selectionStart', '22.12;'.length)
.should('have.a.prop', 'selectionEnd', '22.12;'.length);
});

it('decrements hours segment by pressing ArrowDown at different places of the segment', () => {
cy.get('@input')
.type('{downArrow}')
.should('have.value', '22.12;23')
.should('have.a.prop', 'selectionStart', '22.12;'.length)
.should('have.a.prop', 'selectionEnd', '22.12;'.length)
.type('{rightArrow}{downArrow}')
.should('have.value', '22.12;22')
.should('have.a.prop', 'selectionStart', '22.12;2'.length)
.should('have.a.prop', 'selectionEnd', '22.12;2'.length)
.type('{rightArrow}')
.type('{upArrow}'.repeat(12))
.should('have.value', '22.12;10')
.should('have.a.prop', 'selectionStart', '22.12;10'.length)
.should('have.a.prop', 'selectionEnd', '22.12;10'.length);
});

it('increments/decrements minutes segment by pressing keyboard arrows at different places of the segment', () => {
cy.get('@input')
.type('12:')
.should('have.value', '22.12;12:')
.should('have.a.prop', 'selectionStart', '22.12;12:'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:'.length)
.type('{upArrow}')
.should('have.value', '22.12;12:01')
.should('have.a.prop', 'selectionStart', '22.12;12:'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:'.length)
.type('{rightArrow}')
.type('{upArrow}'.repeat(9))
.should('have.value', '22.12;12:10')
.should('have.a.prop', 'selectionStart', '22.12;12:1'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:1'.length)
.type('{rightArrow}')
.type('{downArrow}'.repeat(34))
.should('have.value', '22.12;12:36')
.should('have.a.prop', 'selectionStart', '22.12;12:36'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:36'.length);
});

it('changes seconds segment by pressing keyboard arrow up/down', () => {
cy.get('@input')
.type('12:10:')
.should('have.value', '22.12;12:10:')
.should('have.a.prop', 'selectionStart', '22.12;12:10:'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:10:'.length)
.type('{downArrow}'.repeat(6))
.should('have.value', '22.12;12:10:54')
.should('have.a.prop', 'selectionStart', '22.12;12:10:'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:10:'.length)
.type('{rightArrow}{upArrow}'.repeat(2))
.should('have.value', '22.12;12:10:56')
.should('have.a.prop', 'selectionStart', '22.12;12:10:56'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:10:56'.length);
});

it('changes milliseconds segment by pressing keyboard arrow up/down', () => {
cy.get('@input')
.type('213212.')
.should('have.value', '22.12;21:32:12.')
.should('have.a.prop', 'selectionStart', '22.12;21:32:12.'.length)
.should('have.a.prop', 'selectionEnd', '22.12;21:32:12.'.length)
.type('{upArrow}{rightArrow}'.repeat(3))
.type('{downArrow}')
.should('have.value', '22.12;21:32:12.002')
.should('have.a.prop', 'selectionStart', '22.12;21:32:12.002'.length)
.should('have.a.prop', 'selectionEnd', '22.12;21:32:12.002'.length);
});

it('type 213212. => 22.12;21:32:12.| => type ({downArrow}{rightArrow}) * 3 + {downArrow} => 22.12:21:32:12.995|', () => {
cy.get('@input')
.type('213212.')
.should('have.value', '22.12;21:32:12.')
.should('have.a.prop', 'selectionStart', '22.12;21:32:12.'.length)
.should('have.a.prop', 'selectionEnd', '22.12;21:32:12.'.length)
.type('{downArrow}{rightArrow}'.repeat(3))
.type('{downArrow}')
.should('have.value', '22.12;21:32:12.996')
.should('have.a.prop', 'selectionStart', '22.12;21:32:12.996'.length)
.should('have.a.prop', 'selectionEnd', '22.12;21:32:12.996'.length);
});

it('should affect only time segments', () => {
cy.get('@input')
.type('123456111')
.should('have.value', '22.12;12:34:56.111')
.should('have.a.prop', 'selectionStart', '22.12;12:34:56.111'.length)
.should('have.a.prop', 'selectionEnd', '22.12;12:34:56.111'.length)
.type('{upArrow}{leftArrow}'.repeat('22.12;12:34:56.111'.length))
.should('have.value', '22.12;15:37:59.115')
.should('have.a.prop', 'selectionStart', 0)
.should('have.a.prop', 'selectionEnd', 0);
});
});

describe('timeStep = 0 (disabled time stepping)', () => {
beforeEach(() => {
cy.visit(
`/${DemoPath.DateTime}/API?dateTimeSeparator=;&dateMode=yy%2Fmm&timeStep=0&timeMode=HH:MM:SS.MSS`,
);
cy.get('#demo-content input')
.should('be.visible')
.first()
.focus()
.as('input');

cy.get('@input')
.type('1202123456000')
.should('have.value', '12.02;12:34:56.000')
.should('have.a.prop', 'selectionStart', '12.02;12:34:56.000'.length)
.should('have.a.prop', 'selectionEnd', '12.02;12:34:56.000'.length);
});

it('should be disabled', BROWSER_SUPPORTS_REAL_EVENTS, () => {
cy.get('@input').realPress('ArrowUp');
nsbarsukov marked this conversation as resolved.
Show resolved Hide resolved

cy.get('@input')
.should('have.a.prop', 'selectionStart', 0)
.should('have.a.prop', 'selectionEnd', 0)
.realPress('ArrowDown');

cy.get('@input')
.should('have.a.prop', 'selectionStart', '12.02;12:34:56.000'.length)
.should('have.a.prop', 'selectionEnd', '12.02;12:34:56.000'.length);
});
});
});
});
Loading
Loading