Skip to content

Commit

Permalink
feat: add focusDelay, hoverDelay and hideDelay to Popover (#6419)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Jul 9, 2024
1 parent 2664b71 commit 60244a7
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
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));
}
}

0 comments on commit 60244a7

Please sign in to comment.