KeyDownHandlerDatePicker extends KeyDownHandlerCommon { @Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); case KeyCodes.KEY_ENTER: moveSelection(keyCode, isShiftKeyDown); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); } KeyDownHandlerDatePicker(final GridLienzoPanel gridPanel,
                                    final GridLayer gridLayer,
                                    final GridWidget gridWidget,
                                    final HasSingletonDOMElementResource gridCell); @Override void onKeyDown(final KeyDownEvent e);  }
@Test public void tabKeyCanvasActions() { final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB), Optional.of(false), Optional.of(false)); handler.onKeyDown(e); verify(gridCell, never()).flush(); verify(gridCell).destroyResources(); verifyCommonActions(); }
@Test public void enterKeyCanvasActions() { final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(false), Optional.of(false)); handler.onKeyDown(e); verify(gridCell, never()).flush(); verify(gridCell, never()).destroyResources(); verifyCommonActions(); }
@Test public void escapeKeyCanvasActions() { final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ESCAPE), Optional.of(false), Optional.of(false)); handler.onKeyDown(e); verify(gridCell, never()).flush(); verify(gridCell).destroyResources(); verifyCommonActions(); }