Search in sources :

Example 11 with GridBodyCellRenderContext

use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.

the class MonacoEditorDOMElementTest method testInitialise.

@Test
public void testInitialise() {
    final GridBodyCellRenderContext context = mock(GridBodyCellRenderContext.class);
    domElement.initialise(context);
    verify(domElement).transform(context);
}
Also used : GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Test(org.junit.Test)

Example 12 with GridBodyCellRenderContext

use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project drools-wb by kiegroup.

the class ListBoxSingletonDOMElementFactoryTest method checkDOMElementCreationBlurHandler.

@Test
@SuppressWarnings("unchecked")
public void checkDOMElementCreationBlurHandler() {
    final GridBodyCellRenderContext context = mock(GridBodyCellRenderContext.class);
    final Consumer<ListBoxDOMElement<String, ListBox>> onCreation = mock(Consumer.class);
    final Consumer<ListBoxDOMElement<String, ListBox>> onDisplay = mock(Consumer.class);
    when(context.getTransform()).thenReturn(mock(Transform.class));
    factory.attachDomElement(context, onCreation, onDisplay);
    final ArgumentCaptor<EventHandler> handlerCaptor = ArgumentCaptor.forClass(EventHandler.class);
    verify(listBox, times(4)).addDomHandler(handlerCaptor.capture(), any(DomEvent.Type.class));
    // KeyDownHandlerCommon
    Assertions.assertThat(handlerCaptor.getAllValues().get(0)).isInstanceOf(KeyDownHandlerCommon.class);
    // KeyDownHandler - stopPropagation
    final KeyDownEvent keyDownEventMock = mock(KeyDownEvent.class);
    Assertions.assertThat(handlerCaptor.getAllValues().get(1)).isInstanceOf(KeyDownHandler.class);
    ((KeyDownHandler) handlerCaptor.getAllValues().get(1)).onKeyDown(keyDownEventMock);
    verify(keyDownEventMock).stopPropagation();
    // MouseDownHandler - stopPropagation
    final MouseDownEvent mouseDownEventMock = mock(MouseDownEvent.class);
    Assertions.assertThat(handlerCaptor.getAllValues().get(2)).isInstanceOf(MouseDownHandler.class);
    ((MouseDownHandler) handlerCaptor.getAllValues().get(2)).onMouseDown(mouseDownEventMock);
    verify(mouseDownEventMock).stopPropagation();
    // BlurHandler
    final BlurEvent blurEventMock = mock(BlurEvent.class);
    Assertions.assertThat(handlerCaptor.getAllValues().get(3)).isInstanceOf(BlurHandler.class);
    ((BlurHandler) handlerCaptor.getAllValues().get(3)).onBlur(blurEventMock);
    verify(factory).flush();
    verify(gridLayer).batch();
    verify(gridLienzoPanel).setFocus(true);
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) EventHandler(com.google.gwt.event.shared.EventHandler) MouseDownEvent(com.google.gwt.event.dom.client.MouseDownEvent) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) Transform(com.ait.lienzo.client.core.types.Transform) MouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler) Test(org.junit.Test)

Aggregations

GridBodyCellRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext)12 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)7 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)7 Node (com.ait.lienzo.client.core.shape.Node)2 Text (com.ait.lienzo.client.core.shape.Text)2 Before (org.junit.Before)2 GridHeaderColumnRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext)2 Transform (com.ait.lienzo.client.core.types.Transform)1 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 MouseDownEvent (com.google.gwt.event.dom.client.MouseDownEvent)1 MouseDownHandler (com.google.gwt.event.dom.client.MouseDownHandler)1 EventHandler (com.google.gwt.event.shared.EventHandler)1 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)1 ScenarioGridColumn (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)1