Search in sources :

Example 11 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method checkReadOnlyHidesCloseIcon.

@Test
public void checkReadOnlyHidesCloseIcon() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    builder.setReadOnly(true);
    verify(view, times(1)).setReadOnly(eq(true));
    verify(documentMenuItem, times(1)).setReadOnly(eq(true));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) Test(org.junit.Test)

Example 12 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method checkInitRemoveDocumentFromRegisteredDocumentMenu.

@Test
public void checkInitRemoveDocumentFromRegisteredDocumentMenu() {
    verify(registeredDocumentsMenuBuilder, times(1)).setRemoveDocumentCommand(removeDocumentCommandCaptor.capture());
    final GuidedDecisionTablePresenter dtPresenter = mock(GuidedDecisionTablePresenter.class);
    doReturn(true).when(presenter).mayClose(eq(dtPresenter));
    doNothing().when(presenter).removeDocument(any(GuidedDecisionTablePresenter.class));
    final ParameterizedCommand<KieDocument> removeDocumentCommand = removeDocumentCommandCaptor.getValue();
    assertNotNull(removeDocumentCommand);
    removeDocumentCommand.execute(dtPresenter);
    verify(presenter, times(1)).mayClose(eq(dtPresenter));
    verify(presenter, times(1)).removeDocument(eq(dtPresenter));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) Test(org.junit.Test)

Example 13 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method checkInitActivateDocumentFromRegisteredDocumentMenu.

@Test
public void checkInitActivateDocumentFromRegisteredDocumentMenu() {
    verify(registeredDocumentsMenuBuilder, times(1)).setActivateDocumentCommand(activateDocumentCommandCaptor.capture());
    final GuidedDecisionTablePresenter dtPresenter = mock(GuidedDecisionTablePresenter.class);
    final ParameterizedCommand<KieDocument> activeDocumentCommand = activateDocumentCommandCaptor.getValue();
    assertNotNull(activeDocumentCommand);
    activeDocumentCommand.execute(dtPresenter);
    verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
    assertNotNull(dtSelectedEventCaptor.getValue());
    assertEquals(dtPresenter, dtSelectedEventCaptor.getValue().getPresenter().get());
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) Test(org.junit.Test)

Aggregations

KieDocument (org.kie.workbench.common.widgets.metadata.client.KieDocument)13 Test (org.junit.Test)12 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)3 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Command (org.uberfire.mvp.Command)1