Search in sources :

Example 6 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method keyPressStopsPropagation.

@Test
public void keyPressStopsPropagation() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.empty(), Optional.empty(), Optional.empty());
    handler.onKeyDown(e);
    verify(e).stopPropagation();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 7 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method tabKeyWithoutShiftMovesRight.

@Test
public void tabKeyWithoutShiftMovesRight() {
    when(context.getRowIndex()).thenReturn(0);
    when(context.getColumnIndex()).thenReturn(1);
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridWidget).selectCell(eq(0), eq(2), eq(false), eq(false));
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 8 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method escapeKeyDoesNotMoveAnywhere.

@Test
public void escapeKeyDoesNotMoveAnywhere() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ESCAPE), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridWidget, never()).selectCell(anyInt(), anyInt(), anyBoolean(), anyBoolean());
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 9 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method mockKeyDownEvent.

protected KeyDownEvent mockKeyDownEvent(final Optional<Integer> keyCode, final Optional<Boolean> isShiftKeyDown, final Optional<Boolean> isControlKeyDown) {
    final KeyDownEvent e = mock(KeyDownEvent.class);
    keyCode.ifPresent((c) -> when(e.getNativeKeyCode()).thenReturn(c));
    isShiftKeyDown.ifPresent((c) -> when(e.isShiftKeyDown()).thenReturn(c));
    isControlKeyDown.ifPresent((c) -> when(e.isControlKeyDown()).thenReturn(c));
    return e;
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent)

Example 10 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class KeyDownHandlerCommonTest method enterKeyCanvasActions.

@Test
public void enterKeyCanvasActions() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridCell).flush();
    verifyCommonActions();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Aggregations

KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)29 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)15 Test (org.junit.Test)12 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)3 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)3 WindowEx (org.rstudio.core.client.dom.WindowEx)3 CanFocus (org.rstudio.core.client.widget.CanFocus)3 FindTextBox (org.rstudio.core.client.widget.FindTextBox)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)2 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)2 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)2 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)2 PostConstruct (javax.annotation.PostConstruct)2 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)2 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)2 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 AccountInfo (com.google.gerrit.client.info.AccountInfo)1