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