use of org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeList in project kie-wb-common by kiegroup.
the class DataTypeListShortcutsTest method testInit.
@Test
public void testInit() {
// The 'init' method is being called during the setup.
final DataTypeListItem listItem = mock(DataTypeListItem.class);
final HTMLElement htmlElement = mock(HTMLElement.class);
final DataTypeList actualDataTypeList = shortcuts.getDataTypeList();
final DataTypeList expectedDataTypeList = shortcuts.getDataTypeList();
when(listItem.getDragAndDropElement()).thenReturn(htmlElement);
assertEquals(expectedDataTypeList, actualDataTypeList);
verify(expectedDataTypeList).registerDataTypeListItemUpdateCallback(onDataTypeListItemUpdateArgumentCaptor.capture());
onDataTypeListItemUpdateArgumentCaptor.getValue().accept(listItem);
verify(view).highlight(htmlElement);
}
use of org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeList in project kie-wb-common by kiegroup.
the class DataTypeListShortcutsViewTest method testScrollTo.
@Test
public void testScrollTo() {
final Element element = mock(Element.class);
final HTMLElement container = mock(HTMLElement.class);
final DataTypeList dataTypeList = mock(DataTypeList.class);
when(presenter.getDataTypeList()).thenReturn(dataTypeList);
when(dataTypeList.getListItems()).thenReturn(container);
view.scrollTo(element);
verify(scrollHelper).scrollTo(element, container, 20);
}
use of org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeList in project kie-wb-common by kiegroup.
the class DataTypeListShortcutsViewTest method testGetVisibleDataTypeListItems.
@Test
public void testGetVisibleDataTypeListItems() {
final DataTypeList dataTypeList = mock(DataTypeList.class);
final DataTypeListItem item1 = mock(DataTypeListItem.class);
final DataTypeListItem item2 = mock(DataTypeListItem.class);
final DataTypeListItem item3 = mock(DataTypeListItem.class);
final DataType dataType1 = fakeDataType("123");
final DataType dataType2 = fakeDataType("456");
final DataType dataType3 = fakeDataType("789");
final Element dataTypeRow1 = fakeDataTypeRow("123");
final Element dataTypeRow2 = fakeDataTypeRow("456");
final Element dataTypeRow3 = fakeDataTypeRow("789");
final List<DataTypeListItem> items = asList(item1, item2, item3);
final JQueryList<Element> jQueryList = mock(JQueryList.class);
when(item1.getDataType()).thenReturn(dataType1);
when(item2.getDataType()).thenReturn(dataType2);
when(item3.getDataType()).thenReturn(dataType3);
when(dataTypeList.getItems()).thenReturn(items);
when(presenter.getDataTypeList()).thenReturn(dataTypeList);
jQueryList.length = 3;
when(jQueryList.get(0)).thenReturn(dataTypeRow1);
when(jQueryList.get(1)).thenReturn(dataTypeRow2);
when(jQueryList.get(2)).thenReturn(dataTypeRow3);
doReturn(jQueryList).when(view).filterVisible();
final List<DataTypeListItem> actual = view.getVisibleDataTypeListItems();
final List<DataTypeListItem> expected = asList(item1, item2, item3);
assertEquals(expected, actual);
}
use of org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeList in project kie-wb-common by kiegroup.
the class DataTypeListShortcutsViewTest method testGetCurrentDataTypeListItem.
@Test
public void testGetCurrentDataTypeListItem() {
final DataTypeList dataTypeList = mock(DataTypeList.class);
final DataTypeListItem item = mock(DataTypeListItem.class);
final DataType dataType = fakeDataType("123");
final Element dataTypeRow1 = fakeDataTypeRow("123");
final Element dataTypeRow2 = fakeDataTypeRow("456");
final Element dataTypeRow3 = fakeDataTypeRow("789");
final JQueryList<Element> jQueryList = mock(JQueryList.class);
final List<DataTypeListItem> items = singletonList(item);
when(item.getDataType()).thenReturn(dataType);
when(dataTypeList.getItems()).thenReturn(items);
when(presenter.getDataTypeList()).thenReturn(dataTypeList);
jQueryList.length = 3;
when(jQueryList.get(0)).thenReturn(dataTypeRow1);
when(jQueryList.get(1)).thenReturn(dataTypeRow2);
when(jQueryList.get(2)).thenReturn(dataTypeRow3);
doReturn(jQueryList).when(view).filterVisible();
doReturn("123").when(view).getCurrentUUID();
final DataTypeListItem actual = view.getCurrentDataTypeListItem().orElseThrow(RuntimeException::new);
assertEquals(item, actual);
}
Aggregations