Search in sources :

Example 1 with CloseCompositeEventHandler

use of org.drools.workbench.screens.scenariosimulation.client.handlers.CloseCompositeEventHandler in project drools-wb by kiegroup.

the class CollectionEditorSingletonDOMElementFactoryTest method registerHandlers.

@Test
public void registerHandlers() {
    CollectionEditorDOMElement collectionEditorDOMElementMock = mock(CollectionEditorDOMElement.class);
    collectionEditorSingletonDOMElementFactorySpy.registerHandlers(collectionEditorViewImpl, collectionEditorDOMElementMock);
    ArgumentCaptor<CloseCompositeEventHandler> closeHandler = ArgumentCaptor.forClass(CloseCompositeEventHandler.class);
    verify(collectionEditorViewImpl, times(1)).addCloseCompositeEventHandler(closeHandler.capture());
    closeHandler.getValue().onEvent(mock(CloseCompositeEvent.class));
    verify(collectionEditorSingletonDOMElementFactorySpy).destroyResources();
    verify(scenarioGridLayerMock).batch();
    verify(scenarioGridPanelMock).setFocus(eq(true));
    verify(collectionEditorDOMElementMock).stopEditingMode();
    reset(collectionEditorSingletonDOMElementFactorySpy);
    reset(scenarioGridLayerMock);
    reset(scenarioGridPanelMock);
    ArgumentCaptor<SaveEditorEventHandler> saveHandler = ArgumentCaptor.forClass(SaveEditorEventHandler.class);
    verify(collectionEditorViewImpl, times(1)).addSaveEditorEventHandler(saveHandler.capture());
    saveHandler.getValue().onEvent(mock(SaveEditorEvent.class));
    verify(collectionEditorSingletonDOMElementFactorySpy).flush();
    verify(scenarioGridLayerMock).batch();
    verify(scenarioGridPanelMock).setFocus(eq(true));
}
Also used : SaveEditorEventHandler(org.drools.workbench.screens.scenariosimulation.client.handlers.SaveEditorEventHandler) SaveEditorEvent(org.drools.workbench.screens.scenariosimulation.client.events.SaveEditorEvent) CloseCompositeEvent(org.drools.workbench.screens.scenariosimulation.client.events.CloseCompositeEvent) CollectionEditorDOMElement(org.drools.workbench.screens.scenariosimulation.client.domelements.CollectionEditorDOMElement) CloseCompositeEventHandler(org.drools.workbench.screens.scenariosimulation.client.handlers.CloseCompositeEventHandler) Test(org.junit.Test)

Aggregations

CollectionEditorDOMElement (org.drools.workbench.screens.scenariosimulation.client.domelements.CollectionEditorDOMElement)1 CloseCompositeEvent (org.drools.workbench.screens.scenariosimulation.client.events.CloseCompositeEvent)1 SaveEditorEvent (org.drools.workbench.screens.scenariosimulation.client.events.SaveEditorEvent)1 CloseCompositeEventHandler (org.drools.workbench.screens.scenariosimulation.client.handlers.CloseCompositeEventHandler)1 SaveEditorEventHandler (org.drools.workbench.screens.scenariosimulation.client.handlers.SaveEditorEventHandler)1 Test (org.junit.Test)1