-
Notifications
You must be signed in to change notification settings - Fork 67
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: implement disable on click for menu item #6815
feat: implement disable on click for menu item #6815
Conversation
52ec96e
to
1712228
Compare
...components-base/src/main/java/com/vaadin/flow/component/shared/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...rent/vaadin-button-flow/src/test/java/com/vaadin/flow/component/button/tests/ButtonTest.java
Outdated
Show resolved
Hide resolved
...n-tests/src/test/java/com/vaadin/flow/component/contextmenu/it/MenuItemDisableOnClickIT.java
Outdated
Show resolved
Hide resolved
...tests/src/main/java/com/vaadin/flow/component/contextmenu/it/MenuItemDisableOnClickView.java
Outdated
Show resolved
Hide resolved
...components-base/src/main/java/com/vaadin/flow/component/shared/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...tests/src/main/java/com/vaadin/flow/component/contextmenu/it/MenuItemDisableOnClickView.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
...s-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
Outdated
Show resolved
Hide resolved
fc7cdbb
to
2b8bbad
Compare
Added a few more tests to the controller, and cleaned up the listener initialization logic. |
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> |
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.
Doesn't look like this is needed anymore.
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.
It is still used in 3 of the unit tests (the ones for initializing disabled on click).
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.
Right, sorry, I was looking at the wrong module.
* if server-side handling takes some time. | ||
*/ | ||
private void initDisableOnClick() { | ||
if (initializedInCurrentRoundTrip) { |
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.
This name is potentially confusing, as this doesn't reset if the component is already attached. It also looks like it's now possible to add multiple attach listeners.
Maybe always early return this method if there is already an attach listener, because then it never needs to run again.
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.
Updated the names and refactored it to return early.
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.
Pushed the changes.
...on-flow-integration-tests/src/test/java/com/vaadin/flow/component/button/tests/ButtonIT.java
Outdated
Show resolved
Hide resolved
...n-tests/src/test/java/com/vaadin/flow/component/contextmenu/it/MenuItemDisableOnClickIT.java
Show resolved
Hide resolved
…se/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
…se/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
…se/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
52861cc
to
eacfffd
Compare
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
This ticket/PR has been released with Vaadin 24.6.0.alpha4 and is also targeting the upcoming stable 24.6.0 version. |
Description
This PR
MenuItem
with the following API:void setDisableOnClick(boolean disableOnClick)
boolean isDisableOnClick()
DisableOnClickController
Fixes #1472
Type of change
Checklist