-
Notifications
You must be signed in to change notification settings - Fork 23
fix: Fix click count in TestBenchElement#click() #2120
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
base: main
Are you sure you want to change the base?
Conversation
Implement integration tests for button click actions.
Replaced callFunction with executeScript to create a MouseEvent for clicking to ensure correct click count.
Changed ButtonView class to extend Div instead of VerticalLayout.
Replaced usage of NativeButtonElement and SpanElement with findElement for better element retrieval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adjusts how TestBenchElement#click() triggers click events so that Flow click listeners receive the correct click count, and adds an integration test view plus tests to verify single and double click behavior and focus.
Changes:
- Update
TestBenchElement.click()to dispatch a customMouseEvent('click')with an explicitdetailvalue instead of calling the element’sclickmethod viacallFunction("click"). - Introduce a
ButtonViewtest route that exposes a native button with single-click, double-click, and focus listeners reflecting click count and focus state in the DOM. - Add
ButtonITintegration tests to validate single-click and double-click behavior (including click count and focus) viaNativeButtonElement.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| vaadin-testbench-shared/src/main/java/com/vaadin/testbench/TestBenchElement.java | Changes click() to use an inline JavaScript text block that dispatches a MouseEvent('click', { detail: 1, ... }) on the element, preserving focus and existing fallback behavior. |
| vaadin-testbench-integration-tests/src/test/java/com/vaadin/tests/elements/ButtonIT.java | Adds JUnit integration tests that exercise NativeButtonElement.click() and .doubleClick() and assert correct click count and focus side effects. |
| vaadin-testbench-integration-tests/src/main/java/com/vaadin/testUI/ButtonView.java | Adds a Flow @Route view with a native button wired with single-click, double-click, and focus listeners that update spans used by the new tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.