Search in sources :

Example 96 with Element

use of org.apache.tapestry5.dom.Element in project kie-wb-common by kiegroup.

the class YearsMonthsSelectorTest method testGetElement.

@Test
public void testGetElement() {
    final HTMLElement expected = mock(HTMLElement.class);
    when(view.getElement()).thenReturn(expected);
    final Element actual = selector.getElement();
    assertEquals(expected, actual);
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) Test(org.junit.Test)

Example 97 with Element

use of org.apache.tapestry5.dom.Element in project kie-wb-common by kiegroup.

the class DataTypeConstraintEnumerationViewTest method testClear.

@Test
public void testClear() {
    final Element element = mock(Element.class);
    items.firstChild = element;
    when(items.removeChild(element)).then(a -> {
        items.firstChild = null;
        return element;
    });
    view.clear();
    verify(items).removeChild(element);
}
Also used : Element(elemental2.dom.Element) HTMLAnchorElement(elemental2.dom.HTMLAnchorElement) HTMLDivElement(elemental2.dom.HTMLDivElement) Test(org.junit.Test)

Example 98 with Element

use of org.apache.tapestry5.dom.Element in project kie-wb-common by kiegroup.

the class DataTypeConstraintExpressionTest method testGetElement.

@Test
public void testGetElement() {
    final HTMLElement expectedElement = mock(HTMLElement.class);
    when(view.getElement()).thenReturn(expectedElement);
    final Element actualElement = constraintExpression.getElement();
    assertEquals(expectedElement, actualElement);
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) Test(org.junit.Test)

Example 99 with Element

use of org.apache.tapestry5.dom.Element in project kie-wb-common by kiegroup.

the class DataTypeConstraintEnumerationTest method testRender.

@Test
public void testRender() {
    final DataTypeConstraintEnumerationItem item1 = mock(DataTypeConstraintEnumerationItem.class);
    final DataTypeConstraintEnumerationItem item2 = mock(DataTypeConstraintEnumerationItem.class);
    final Element element1 = mock(Element.class);
    final Element element2 = mock(Element.class);
    final InOrder inorder = Mockito.inOrder(view);
    when(item1.getOrder()).thenReturn(1);
    when(item2.getOrder()).thenReturn(0);
    when(item1.getElement()).thenReturn(element1);
    when(item2.getElement()).thenReturn(element2);
    doReturn(asList(item1, item2)).when(constraintEnumeration).getEnumerationItems();
    constraintEnumeration.render();
    verify(constraintEnumeration).scheduleRender(scheduledCommandArgumentCaptor.capture());
    scheduledCommandArgumentCaptor.getValue().execute();
    verify(view).clear();
    inorder.verify(view).addItem(element2);
    inorder.verify(view).addItem(element1);
}
Also used : DataTypeConstraintEnumerationItem(org.kie.workbench.common.dmn.client.editors.types.listview.constraint.enumeration.item.DataTypeConstraintEnumerationItem) InOrder(org.mockito.InOrder) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) Test(org.junit.Test)

Example 100 with Element

use of org.apache.tapestry5.dom.Element in project kie-wb-common by kiegroup.

the class DataTypeConstraintEnumerationTest method testAddEnumerationItem.

@Test
public void testAddEnumerationItem() {
    final DataTypeConstraintEnumerationItem item = mock(DataTypeConstraintEnumerationItem.class);
    final List<DataTypeConstraintEnumerationItem> items = spy(new ArrayList<>());
    final Element element = mock(Element.class);
    doReturn(items).when(constraintEnumeration).getEnumerationItems();
    doReturn(item).when(constraintEnumeration).makeEnumerationItem("");
    doReturn(element).when(constraintEnumeration).getElement();
    doNothing().when(constraintEnumeration).refreshEnumerationItemsOrder();
    constraintEnumeration.addEnumerationItem();
    verify(items).add(item);
    verify(constraintEnumeration).refreshEnumerationItemsOrder();
    verify(constraintEnumeration).render();
    verify(constraintEnumeration).scrollToBottom();
    verify(item).enableEditMode();
    verify(item).setOrder(items.size() - 1);
}
Also used : DataTypeConstraintEnumerationItem(org.kie.workbench.common.dmn.client.editors.types.listview.constraint.enumeration.item.DataTypeConstraintEnumerationItem) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) Test(org.junit.Test)

Aggregations

Element (elemental2.dom.Element)269 HTMLElement (elemental2.dom.HTMLElement)215 Test (org.junit.Test)175 HTMLDivElement (elemental2.dom.HTMLDivElement)129 HTMLButtonElement (elemental2.dom.HTMLButtonElement)63 HTMLInputElement (elemental2.dom.HTMLInputElement)60 Element (org.apache.tapestry5.dom.Element)39 DOMTokenList (elemental2.dom.DOMTokenList)38 Test (org.testng.annotations.Test)34 HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)32 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)29 MarkupWriter (org.apache.tapestry5.MarkupWriter)16 ArrayList (java.util.ArrayList)14 IsElement (org.jboss.gwt.elemento.core.IsElement)14 List (java.util.List)13 Elements (org.jboss.gwt.elemento.core.Elements)13 HTMLSelectElement (elemental2.dom.HTMLSelectElement)12 EventType.click (org.jboss.gwt.elemento.core.EventType.click)12 ComponentModel (org.apache.tapestry5.model.ComponentModel)11 Ids (org.jboss.hal.resources.Ids)11