Search in sources :

Example 1 with KieDocument

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

the class RegisteredDocumentsMenuBuilderTest method checkNotReadOnlyDisplaysCloseIcon.

@Test
public void checkNotReadOnlyDisplaysCloseIcon() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    // By default DocumentMenuItems are set to be read-only
    verify(documentMenuItem, times(1)).setReadOnly(eq(false));
    builder.setReadOnly(false);
    verify(view, times(1)).setReadOnly(eq(false));
    verify(documentMenuItem, times(2)).setReadOnly(eq(false));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) Test(org.junit.Test)

Example 2 with KieDocument

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

the class RegisteredDocumentsMenuBuilderTest method testOnActivateDocument_WithCommand.

@Test
@SuppressWarnings("unchecked")
public void testOnActivateDocument_WithCommand() {
    final KieDocument document = makeKieDocument();
    final ParameterizedCommand command = mock(ParameterizedCommand.class);
    builder.setActivateDocumentCommand(command);
    builder.onActivateDocument(document);
    verify(command, times(1)).execute(eq(document));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Test(org.junit.Test)

Example 3 with KieDocument

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

the class RegisteredDocumentsMenuBuilderTest method testDispose.

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

Example 4 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 5 with KieDocument

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

the class RegisteredDocumentsMenuBuilderTest method testOnRemoveDocument_WithCommand.

@Test
@SuppressWarnings("unchecked")
public void testOnRemoveDocument_WithCommand() {
    final KieDocument document = makeKieDocument();
    final ParameterizedCommand command = mock(ParameterizedCommand.class);
    builder.setRemoveDocumentCommand(command);
    builder.onRemoveDocument(document);
    verify(command, times(1)).execute(eq(document));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) 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