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();
}
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));
}
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());
}
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;
}
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();
}
Aggregations