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: add disabledDays prop to Calendar #2428

Merged
merged 2 commits into from Jul 11, 2022
Merged

Conversation

HellWolf93
Copy link
Collaborator

fix: #2423

Changes proposed in this PR:

@commit-lint
Copy link

commit-lint bot commented Jul 10, 2022

Features

  • add disabledDays prop to Calendar (502b83a)

Contributors

HellWolf93, LeandroTorresSicilia

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

await expect(await calendar.getLeftMonthSelectedDay()).toBe(undefined);
await expect(await calendar.getRightMonthSelectedDay()).toBe('6');
});
it('should focus the correct day in left month when an arrow key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

await browser.keys('ArrowRight');
await expect(await calendar.isLeftMonthDayFocused(11)).toBe(true);
});
it('should focus the correct day in right month when an arrow key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

await browser.keys('ArrowRight');
await expect(await calendar.isRightMonthDayFocused(11)).toBe(true);
});
it('should focus the first day of the week in left month when HOME key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 6 locations. Consider refactoring.

await browser.keys('Home');
await expect(await calendar.isLeftMonthDayFocused(8)).toBe(true);
});
it('should focus the first day of the week in right month when HOME key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 6 locations. Consider refactoring.

await browser.keys('Home');
await expect(await calendar.isRightMonthDayFocused(5)).toBe(true);
});
it('should focus the last day of the week in left month when END key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 6 locations. Consider refactoring.

@github-actions
Copy link

github-actions bot commented Jul 10, 2022

Visit the preview URL for this PR (updated for commit 99b5600):

https://react-rainbow--pr2428-add-disabled-days-53i0tjwl.web.app

(expires Mon, 18 Jul 2022 17:31:26 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

await browser.keys('End');
await expect(await calendar.isLeftMonthDayFocused(14)).toBe(true);
});
it('should focus the last day of the week in right month when END key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 6 locations. Consider refactoring.

await expect(await calendar.getRightSelectedMonth()).toBe('February');
await expect(await calendar.isRightMonthDayFocused(11)).toBe(true);
});
it('should change to the previous year when ALT + PAGEUP keys are pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

await browser.keys('Tab');
await expect(await calendar.isRightMonthDayFocused(11)).toBe(true);
});
it('should change to next year when ALT + PAGEDOWN keys are pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

await expect(await calendar.getRightSelectedMonth()).toBe('February');
await expect(await calendar.isRightMonthDayFocused(1)).toBe(true);
});
it('should change to the previous month when PAGEUP key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

await expect(await calendar.getRightSelectedMonth()).toBe('December');
await expect(await calendar.isLeftMonthDayFocused(11)).toBe(true);
});
it('should change to next month when PAGEDOWN key is pressed', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Jul 11, 2022

Code Climate has analyzed commit 99b5600 and detected 28 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 27

View more on Code Climate.

@LeandroTorresSicilia LeandroTorresSicilia merged commit 335a492 into master Jul 11, 2022
@LeandroTorresSicilia LeandroTorresSicilia deleted the add-disabled-days branch July 11, 2022 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabling custom date/s in the calendar / date picker.
2 participants