@Test public void testAddItem() { final Element enumerationItem = mock(Element.class); final DragAndDropHelper helper = mock(DragAndDropHelper.class); items.childNodes = mock(NodeList.class); doReturn(helper).when(view).getDragAndDropHelper(); view.addItem(enumerationItem); verify(items).appendChild(enumerationItem); verify(helper).refreshItemsPosition(); verify(enumerationItem).setAttribute(DATA_POSITION, 0); }
@Override public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); }
DataTypeConstraintEnumerationView implements DataTypeConstraintEnumeration.View { @Override public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); } }
DataTypeConstraintEnumerationView implements DataTypeConstraintEnumeration.View { @Override public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); } @Inject  DataTypeConstraintEnumerationView(final HTMLDivElement items,
                                             final HTMLAnchorElement addIcon,
                                             final HTMLDivElement addButtonContainer); }
DataTypeConstraintEnumerationView implements DataTypeConstraintEnumeration.View { @Override public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); } @Inject  DataTypeConstraintEnumerationView(final HTMLDivElement items,
                                             final HTMLAnchorElement addIcon,
                                             final HTMLDivElement addButtonContainer); @Override void init(final DataTypeConstraintEnumeration presenter); @EventHandler("add-icon") void onAddIconClick(final ClickEvent e); @Override void clear(); @Override void addItem(final Element enumerationItem); }
DataTypeConstraintEnumerationView implements DataTypeConstraintEnumeration.View { @Override public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); } @Inject  DataTypeConstraintEnumerationView(final HTMLDivElement items,
                                             final HTMLAnchorElement addIcon,
                                             final HTMLDivElement addButtonContainer); @Override void init(final DataTypeConstraintEnumeration presenter); @EventHandler("add-icon") void onAddIconClick(final ClickEvent e); @Override void clear(); @Override void addItem(final Element enumerationItem);  }