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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations