use of com.ait.lienzo.client.core.event.NodeMouseClickHandler in project kie-wb-common by kiegroup.
the class AbstractActionsToolboxViewTest method testAddButton.
@SuppressWarnings("unchecked")
protected void testAddButton(final Consumer<MouseClickEvent> clickEventConsumer) {
// Verify tootlip.
verify(toolboxTooltip, times(1)).createItem(eq("title1"));
verify(buttonItem, times(1)).tooltip(any(TooltipItem.class));
// Verify mouse enter.
final ArgumentCaptor<NodeMouseEnterHandler> enterHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseEnterHandler.class);
verify(buttonItem, times(1)).onMouseEnter(enterHandlerArgumentCaptor.capture());
final NodeMouseEnterHandler enterHandler = enterHandlerArgumentCaptor.getValue();
final NodeMouseEnterEvent mouseEnterEvent = mock(NodeMouseEnterEvent.class);
enterHandler.onNodeMouseEnter(mouseEnterEvent);
verify(canvasView, times(1)).setCursor(eq(AbstractCanvas.Cursors.POINTER));
// Verify mouse exit.
final ArgumentCaptor<NodeMouseExitHandler> exitHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseExitHandler.class);
verify(buttonItem, times(1)).onMouseExit(exitHandlerArgumentCaptor.capture());
final NodeMouseExitHandler exitHandler = exitHandlerArgumentCaptor.getValue();
final NodeMouseExitEvent mouseExitEvent = mock(NodeMouseExitEvent.class);
exitHandler.onNodeMouseExit(mouseExitEvent);
verify(canvasView, times(1)).setCursor(eq(AbstractCanvas.Cursors.AUTO));
// Verify mouse click.
final ArgumentCaptor<NodeMouseClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseClickHandler.class);
verify(buttonItem, times(1)).onClick(clickHandlerArgumentCaptor.capture());
final NodeMouseClickHandler clickHandler = clickHandlerArgumentCaptor.getValue();
final NodeMouseClickEvent mouseClickEvent = mock(NodeMouseClickEvent.class);
when(mouseClickEvent.getMouseEvent()).thenReturn(mock(MouseEvent.class));
clickHandler.onNodeMouseClick(mouseClickEvent);
verify(clickEventConsumer, times(1)).accept(any(MouseClickEvent.class));
}
Aggregations