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

fix: datepicker doesnt close on first selection of date on month change #34679

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

SaiCharanChetpelly31
Copy link
Contributor

@SaiCharanChetpelly31 SaiCharanChetpelly31 commented Jul 3, 2024

Fixes issue #30701

Summary by CodeRabbit

  • New Features

    • Added comprehensive tests for the DatePicker widget's property pane with JavaScript bindings, ensuring robust date selection functionality.
  • Bug Fixes

    • Improved date selection behavior in the DatePicker widget to ensure the datepicker closes on a single click when the month is changed.
  • Refactor

    • Updated the onChange function in the DatePicker component to format and update the date before invoking the callback, enhancing the reliability of date formatting.

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

The recent changes introduced tests for the DatePicker widget's property pane with JavaScript bindings and refactored the date change handling in the DatePicker component. Additionally, utility functions for testing were integrated to enhance the test suite, focusing on improved navigation and date selection functionalities.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker4_spec.js Added new test suite for DatePicker widget's property pane, including navigation, date selection, and click tests.
app/client/src/widgets/DatePickerWidget2/component/index.tsx Refactored onChange function to handleDateChange for formatting and state updates before calling onDateSelected.
...support/Objects/ObjectsCore and ...locators/WidgetLocators Added imports: draggableWidgets, entityExplorer, agHelper, and datePickerlocators.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TestSuite as Test Suite
    participant Datepicker as DatePickerComponent

    User ->> TestSuite: Run test
    TestSuite ->> Datepicker: Navigate to DatePicker widget
    TestSuite ->> Datepicker: Select random date
    Note right of Datepicker: Changes month
    TestSuite ->> Datepicker: Click to close
    Datepicker ->> TestSuite: DatePicker closed
Loading

Poem

🐇 Beneath the code of yore, we weave,
Date selections grand, commands achieve.
Tests now bound with JavaScript flair,
Ensuring clicks and dates meet with care.
Widgets dance in harmony,
All is well in our repository.
🕊️

Tip

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker4_spec.js (1)

33-40: Use a more descriptive test name.

The test name should clearly convey the intent of the test.

- it("1.should close datepicker on single click when month is changed", function () {
+ it("should close the datepicker on a single click after changing the month", function () {
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5d879ec and d94581a.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker4_spec.js (1 hunks)
  • app/client/src/widgets/DatePickerWidget2/component/index.tsx (2 hunks)
Additional context used
Path-based instructions (2)
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker4_spec.js (1)

Pattern **/*.*: Do not use cy.wait in code.
Do call the add function.
Do not keep duplicate lines in code.
Descriptive test names are used to clearly convey the intent of each test.

app/client/src/widgets/DatePickerWidget2/component/index.tsx (1)

Pattern **/*.*: Do not use cy.wait in code.
Do call the add function.
Do not keep duplicate lines in code.
Descriptive test names are used to clearly convey the intent of each test.

Additional comments not posted (4)
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker4_spec.js (1)

17-31: Verify date selection logic.

Ensure that the selected date is within the valid range of dates for the DatePicker widget.

app/client/src/widgets/DatePickerWidget2/component/index.tsx (3)

484-491: Verify date formatting logic.

Ensure that the date formatting logic is consistent with the rest of the application.


380-380: Verify edge case handling in handleDateChange.

Ensure that the handleDateChange function correctly handles all edge cases, such as null or invalid dates.


483-491: Verify synchronization of state update and prop call.

Ensure that the state update and prop call in the handleDateChange function are correctly synchronized to avoid potential issues.

Comment on lines +1 to +7
import {
draggableWidgets,
entityExplorer,
agHelper,
} from "../../../../../support/Objects/ObjectsCore";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import { datePickerlocators } from "../../../../../locators/WidgetLocators";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unused import.

The import statement for _ from "../../../../../support/Objects/ObjectsCore" is unused and can be removed to keep the code clean.

- import * as _ from "../../../../../support/Objects/ObjectsCore";
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
draggableWidgets,
entityExplorer,
agHelper,
} from "../../../../../support/Objects/ObjectsCore";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import { datePickerlocators } from "../../../../../locators/WidgetLocators";
import {
draggableWidgets,
entityExplorer,
agHelper,
} from "../../../../../support/Objects/ObjectsCore";
import { datePickerlocators } from "../../../../../locators/WidgetLocators";

@SaiCharanChetpelly31
Copy link
Contributor Author

@ApekshaBhosale I accidentally deleted my forked repository, but I have raised PR with the suggested changes addressing the comments. Could you please review this PR?

@SaiCharanChetpelly31
Copy link
Contributor Author

Hi @ApekshaBhosale

I hope you're well. I’m curious and excited to hear your thoughts on my pull request raised a while ago. Looking forward to your review!
Thank you.

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.

None yet

1 participant