Search in sources :

Example 1 with IncludedKnowledgeBaseItemPresenter

use of org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter in project kie-wb-common by kiegroup.

the class ListPresenterTest method newPresenterForTest.

@Test
public void newPresenterForTest() {
    final IncludedKnowledgeBaseItemPresenter p1 = spy(new IncludedKnowledgeBaseItemPresenter(null));
    doReturn(p1).when(includedKnowledgeBaseItemPresenters).get();
    listPresenter.setup(mock(HTMLElement.class), new ArrayList<>(), (o, p) -> {
        assertEquals(new SingleValueItemObjectModel("foo"), o);
        assertEquals(p1, p);
    });
    listPresenter.newPresenterFor(new SingleValueItemObjectModel("foo"));
    verify(p1).setListPresenter(eq(listPresenter));
}
Also used : SingleValueItemObjectModel(org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel) HTMLElement(elemental2.dom.HTMLElement) IncludedKnowledgeBaseItemPresenter(org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter) Test(org.junit.Test)

Example 2 with IncludedKnowledgeBaseItemPresenter

use of org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter in project kie-wb-common by kiegroup.

the class ListPresenterTest method testSetupWithPresenters.

@Test
public void testSetupWithPresenters() {
    doNothing().when(listPresenter).addPresenter(any());
    final IncludedKnowledgeBaseItemPresenter p1 = mock(IncludedKnowledgeBaseItemPresenter.class);
    doReturn(new SingleValueItemObjectModel("foo")).when(p1).getObject();
    final IncludedKnowledgeBaseItemPresenter p2 = mock(IncludedKnowledgeBaseItemPresenter.class);
    doReturn(new SingleValueItemObjectModel("bar")).when(p2).getObject();
    final List<IncludedKnowledgeBaseItemPresenter> presenters = Arrays.asList(p1, p2);
    listPresenter.setupWithPresenters(mock(HTMLElement.class), presenters, (a, b) -> {
    });
    assertEquals(presenters, listPresenter.getPresenters());
    assertEquals(Arrays.asList(new SingleValueItemObjectModel("foo"), new SingleValueItemObjectModel("bar")), listPresenter.getObjectsList());
    verify(listPresenter, times(2)).addPresenter(any());
}
Also used : SingleValueItemObjectModel(org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel) HTMLElement(elemental2.dom.HTMLElement) IncludedKnowledgeBaseItemPresenter(org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter) Test(org.junit.Test)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)2 Test (org.junit.Test)2 IncludedKnowledgeBaseItemPresenter (org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter)2 SingleValueItemObjectModel (org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel)2