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 focusDelay, hoverDelay and hideDelay to Popover #6419

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,67 @@ public String getFor() {
return getElement().getProperty("for");
}

/**
* The delay in milliseconds before the popover is opened on target keyboard
* focus.
*
* @param focusDelay
* the delay in milliseconds
*/
public void setFocusDelay(int focusDelay) {
getElement().setProperty("focusDelay", focusDelay);
}

/**
* The delay in milliseconds before the popover is opened on target keyboard
* focus.
*
* @return the delay in milliseconds
*/
public int getFocusDelay() {
return getElement().getProperty("focusDelay", 0);
}

/**
* The delay in milliseconds before the popover is opened on target hover.
*
* @param hoverDelay
* the delay in milliseconds
*/
public void setHoverDelay(int hoverDelay) {
getElement().setProperty("hoverDelay", hoverDelay);
}

/**
* The delay in milliseconds before the popover is opened on target hover.
*
* @return the delay in milliseconds
*/
public int getHoverDelay() {
return getElement().getProperty("hoverDelay", 0);
}

/**
* The delay in milliseconds before the popover is closed on losing hover.
* On target blur, the popover is closed immediately.
*
* @param hideDelay
* the delay in milliseconds
*/
public void setHideDelay(int hideDelay) {
getElement().setProperty("hideDelay", hideDelay);
}

/**
* The delay in milliseconds before the popover is closed on losing hover.
* On target blur, the popover is closed immediately.
*
* @return the delay in milliseconds
*/
public int getHideDelay() {
return getElement().getProperty("hideDelay", 0);
}

/**
* Sets the target component for this popover.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,34 @@ public void setPosition_getPosition() {
public void defaultPosition_equalsNull() {
Assert.assertEquals(null, popover.getPosition());
}

@Test
public void setFocusDelay_getFocusDelay() {
Assert.assertEquals(0, popover.getFocusDelay());

popover.setFocusDelay(1000);
Assert.assertEquals(1000, popover.getFocusDelay());
Assert.assertEquals(1000,
popover.getElement().getProperty("focusDelay", 0));
}

@Test
public void setHoverDelay_getHoverDelay() {
Assert.assertEquals(0, popover.getHoverDelay());

popover.setHoverDelay(1000);
Assert.assertEquals(1000, popover.getHoverDelay());
Assert.assertEquals(1000,
popover.getElement().getProperty("hoverDelay", 0));
}

@Test
public void setHideDelay_getHideDelay() {
Assert.assertEquals(0, popover.getHideDelay());

popover.setHideDelay(1000);
Assert.assertEquals(1000, popover.getHideDelay());
Assert.assertEquals(1000,
popover.getElement().getProperty("hideDelay", 0));
}
}