Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneeza committed Dec 18, 2023
1 parent c67cad4 commit 3112ac2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
20 changes: 20 additions & 0 deletions packages/date-picker/src/DatePicker/DatePicker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,26 @@ describe('packages/date-picker', () => {
*/
describe('Arrow key', () => {
describe('Input', () => {
describe('Left Arrow', () => {
test('moves the cursor when the value starts with 0', () => {
const { monthInput } = renderDatePicker({});
userEvent.type(monthInput, '04{arrowleft}{arrowleft}');
expect(monthInput).toHaveFocus();
});

test('moves the cursor when the value is 0', () => {
const { monthInput } = renderDatePicker({});
userEvent.type(monthInput, '0{arrowleft}');
expect(monthInput).toHaveFocus();
});

test('moves the cursor to the next segment when the value is 0', () => {
const { yearInput, monthInput } = renderDatePicker({});
userEvent.type(monthInput, '0{arrowleft}{arrowleft}');
expect(yearInput).toHaveFocus();
});
});

test('right arrow moves focus through segments', () => {
const { yearInput, monthInput, dayInput } = renderDatePicker();
userEvent.click(yearInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,6 @@ describe('packages/date-picker/date-picker-input', () => {
userEvent.keyboard('{arrowleft}{arrowleft}{arrowleft}');
expect(yearInput).toHaveFocus();
});

test('moves the cursor when the value starts with 0', () => {
const { monthInput } = renderDatePickerInput({});
userEvent.type(monthInput, '04{arrowleft}{arrowleft}');
expect(monthInput).toHaveFocus();
});

test('moves the cursor when the value is 0', () => {
const { monthInput } = renderDatePickerInput({});
userEvent.type(monthInput, '0{arrowleft}');
expect(monthInput).toHaveFocus();
});

test('moves the cursor to the next segment when the value is 0', () => {
const { yearInput, monthInput } = renderDatePickerInput({});
userEvent.type(monthInput, '0{arrowleft}{arrowleft}');
expect(yearInput).toHaveFocus();
});
});

describe('Right Arrow', () => {
Expand Down

0 comments on commit 3112ac2

Please sign in to comment.