Search in sources :

Example 1 with DataTypeConstraintComponent

use of org.kie.workbench.common.dmn.client.editors.types.listview.constraint.common.DataTypeConstraintComponent in project kie-wb-common by kiegroup.

the class DataTypeConstraintModalTest method testSave.

@Test
public void testSave() {
    final DataTypeConstraintComponent constrainComponent = mock(DataTypeConstraintComponent.class);
    final String value = "value";
    doNothing().when(modal).doSave(Mockito.<String>any());
    doReturn(constrainComponent).when(modal).getCurrentComponent();
    when(constrainComponent.getValue()).thenReturn(value);
    modal.save();
    verify(modal).doSave(value);
}
Also used : DataTypeConstraintComponent(org.kie.workbench.common.dmn.client.editors.types.listview.constraint.common.DataTypeConstraintComponent) Test(org.junit.Test)

Example 2 with DataTypeConstraintComponent

use of org.kie.workbench.common.dmn.client.editors.types.listview.constraint.common.DataTypeConstraintComponent in project kie-wb-common by kiegroup.

the class DataTypeConstraintModalViewTest method testLoadComponent.

@Test
public void testLoadComponent() {
    final ConstraintType constraintType = ENUMERATION;
    final DataTypeConstraintComponent constrainComponent = mock(DataTypeConstraintComponent.class);
    final Element element = mock(Element.class);
    final Element previous = mock(Element.class);
    componentContainer.firstChild = previous;
    when(presenter.getCurrentComponent()).thenReturn(constrainComponent);
    when(constrainComponent.getElement()).thenReturn(element);
    when(componentContainer.removeChild(previous)).then(a -> {
        componentContainer.firstChild = null;
        return element;
    });
    view.loadComponent(constraintType);
    verify(componentContainer).removeChild(previous);
    verify(presenter).setupComponent(constraintType);
    verify(componentContainer).appendChild(element);
}
Also used : Element(elemental2.dom.Element) HTMLAnchorElement(elemental2.dom.HTMLAnchorElement) HTMLElement(elemental2.dom.HTMLElement) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement) ConstraintType(org.kie.workbench.common.dmn.api.definition.model.ConstraintType) DataTypeConstraintComponent(org.kie.workbench.common.dmn.client.editors.types.listview.constraint.common.DataTypeConstraintComponent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 DataTypeConstraintComponent (org.kie.workbench.common.dmn.client.editors.types.listview.constraint.common.DataTypeConstraintComponent)2 Element (elemental2.dom.Element)1 HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)1 HTMLButtonElement (elemental2.dom.HTMLButtonElement)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 HTMLElement (elemental2.dom.HTMLElement)1 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)1